]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge git://oss.sgi.com:8090/oss/git/xfs-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Thu, 12 Jan 2006 17:10:34 +0000 (09:10 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 12 Jan 2006 17:10:34 +0000 (09:10 -0800)
797 files changed:
Documentation/filesystems/ext3.txt
Documentation/kdump/gdbmacros.txt
Documentation/kernel-parameters.txt
Documentation/oops-tracing.txt
Documentation/video4linux/CARDLIST.bttv
Documentation/video4linux/CARDLIST.cx88
Documentation/x86_64/boot-options.txt
Documentation/x86_64/cpu-hotplug-spec [new file with mode: 0644]
MAINTAINERS
arch/alpha/kernel/pci-noop.c
arch/alpha/kernel/process.c
arch/alpha/kernel/ptrace.c
arch/alpha/kernel/smp.c
arch/arm/common/rtctime.c
arch/arm/kernel/apm.c
arch/arm/kernel/process.c
arch/arm/kernel/ptrace.c
arch/arm/kernel/smp.c
arch/arm/kernel/traps.c
arch/arm26/kernel/process.c
arch/arm26/kernel/ptrace.c
arch/arm26/kernel/traps.c
arch/cris/arch-v10/drivers/ds1302.c
arch/cris/arch-v10/drivers/pcf8563.c
arch/cris/arch-v10/kernel/process.c
arch/cris/arch-v10/kernel/ptrace.c
arch/cris/arch-v32/kernel/process.c
arch/cris/arch-v32/kernel/ptrace.c
arch/cris/arch-v32/kernel/smp.c
arch/cris/arch-v32/mm/tlb.c
arch/frv/kernel/process.c
arch/h8300/kernel/process.c
arch/i386/Kconfig
arch/i386/kernel/acpi/boot.c
arch/i386/kernel/apic.c
arch/i386/kernel/apm.c
arch/i386/kernel/cpu/amd.c
arch/i386/kernel/cpu/common.c
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h [deleted file]
arch/i386/kernel/cpu/intel.c
arch/i386/kernel/cpu/mtrr/if.c
arch/i386/kernel/cpu/proc.c
arch/i386/kernel/dmi_scan.c
arch/i386/kernel/io_apic.c
arch/i386/kernel/ioport.c
arch/i386/kernel/kprobes.c
arch/i386/kernel/microcode.c
arch/i386/kernel/process.c
arch/i386/kernel/reboot.c
arch/i386/kernel/setup.c
arch/i386/kernel/smpboot.c
arch/i386/kernel/time.c
arch/i386/kernel/vm86.c
arch/ia64/hp/sim/simserial.c
arch/ia64/ia32/elfcore32.h
arch/ia64/ia32/ia32_signal.c
arch/ia64/ia32/ia32_support.c
arch/ia64/ia32/sys_ia32.c
arch/ia64/kernel/kprobes.c
arch/ia64/kernel/mca.c
arch/ia64/kernel/perfmon.c
arch/ia64/kernel/process.c
arch/ia64/kernel/ptrace.c
arch/ia64/kernel/salinfo.c
arch/ia64/kernel/setup.c
arch/ia64/kernel/signal.c
arch/ia64/kernel/sys_ia64.c
arch/ia64/sn/kernel/tiocx.c
arch/m32r/kernel/process.c
arch/m32r/kernel/ptrace.c
arch/m32r/kernel/smpboot.c
arch/m68k/amiga/amiints.c
arch/m68k/amiga/amisound.c
arch/m68k/amiga/cia.c
arch/m68k/amiga/config.c
arch/m68k/apollo/config.c
arch/m68k/atari/config.c
arch/m68k/bvme6000/rtc.c
arch/m68k/hp300/config.c
arch/m68k/kernel/asm-offsets.c
arch/m68k/kernel/head.S
arch/m68k/kernel/process.c
arch/m68k/kernel/setup.c
arch/m68k/kernel/signal.c
arch/m68k/kernel/sys_m68k.c
arch/m68k/kernel/traps.c
arch/m68k/kernel/vmlinux-std.lds
arch/m68k/kernel/vmlinux-sun3.lds
arch/m68k/lib/checksum.c
arch/m68k/mac/config.c
arch/m68k/mac/iop.c
arch/m68k/mac/misc.c
arch/m68k/math-emu/multi_arith.h
arch/m68k/mm/kmap.c
arch/m68k/mvme16x/rtc.c
arch/m68k/q40/config.c
arch/m68k/sun3/config.c
arch/m68k/sun3x/config.c
arch/m68knommu/kernel/process.c
arch/mips/kernel/process.c
arch/mips/kernel/ptrace.c
arch/mips/kernel/ptrace32.c
arch/mips/kernel/smp_mt.c
arch/mips/kernel/syscall.c
arch/mips/kernel/sysirix.c
arch/mips/kernel/traps.c
arch/mips/pmc-sierra/yosemite/smp.c
arch/mips/sgi-ip27/ip27-smp.c
arch/mips/sibyte/cfe/smp.c
arch/parisc/hpux/sys_hpux.c
arch/parisc/kernel/perf.c
arch/parisc/kernel/process.c
arch/parisc/kernel/smp.c
arch/powerpc/Kconfig
arch/powerpc/Kconfig.debug
arch/powerpc/boot/.gitignore [new file with mode: 0644]
arch/powerpc/boot/Makefile
arch/powerpc/configs/ppc64_defconfig
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/crash.c
arch/powerpc/kernel/crash_dump.c
arch/powerpc/kernel/kprobes.c
arch/powerpc/kernel/machine_kexec.c
arch/powerpc/kernel/pci_64.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/ptrace-common.h
arch/powerpc/kernel/rtas.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/kernel/smp.c
arch/powerpc/kernel/udbg.c
arch/powerpc/kernel/udbg_16550.c
arch/powerpc/kernel/vdso32/.gitignore [new file with mode: 0644]
arch/powerpc/kernel/vdso64/.gitignore [new file with mode: 0644]
arch/powerpc/platforms/83xx/Kconfig [new file with mode: 0644]
arch/powerpc/platforms/83xx/Makefile [new file with mode: 0644]
arch/powerpc/platforms/Makefile
arch/powerpc/platforms/cell/smp.c
arch/powerpc/platforms/cell/spufs/switch.c
arch/powerpc/platforms/embedded6xx/Kconfig
arch/powerpc/platforms/iseries/setup.c
arch/powerpc/platforms/powermac/udbg_scc.c
arch/powerpc/platforms/pseries/smp.c
arch/powerpc/sysdev/Makefile
arch/ppc/4xx_io/serial_sicc.c
arch/ppc/Kconfig
arch/ppc/amiga/amiints.c
arch/ppc/amiga/cia.c
arch/ppc/amiga/config.c
arch/ppc/kernel/ppc_htab.c
arch/ppc/kernel/process.c
arch/ppc/kernel/smp.c
arch/ppc/platforms/apus_setup.c
arch/ppc/xmon/xmon.c
arch/s390/kernel/binfmt_elf32.c
arch/s390/kernel/compat_linux.c
arch/s390/kernel/process.c
arch/s390/kernel/ptrace.c
arch/s390/kernel/smp.c
arch/s390/kernel/time.c
arch/s390/kernel/traps.c
arch/sh/kernel/process.c
arch/sh/kernel/ptrace.c
arch/sh/kernel/smp.c
arch/sh64/kernel/process.c
arch/sh64/lib/dbg.c
arch/sparc/kernel/process.c
arch/sparc/kernel/ptrace.c
arch/sparc/kernel/sun4d_smp.c
arch/sparc/kernel/sun4m_smp.c
arch/sparc/kernel/sys_sunos.c
arch/sparc/kernel/traps.c
arch/sparc64/Kconfig
arch/sparc64/kernel/kprobes.c
arch/sparc64/kernel/process.c
arch/sparc64/kernel/ptrace.c
arch/sparc64/kernel/setup.c
arch/sparc64/kernel/smp.c
arch/sparc64/kernel/sys_sparc32.c
arch/sparc64/kernel/sys_sunos32.c
arch/sparc64/kernel/traps.c
arch/sparc64/solaris/fs.c
arch/um/Kconfig
arch/um/Makefile
arch/um/drivers/mconsole_kern.c
arch/um/drivers/ubd_kern.c
arch/um/include/sysdep-i386/kernel-offsets.h [moved from arch/um/sys-i386/kernel-offsets.c with 80% similarity]
arch/um/include/sysdep-x86_64/kernel-offsets.h [moved from arch/um/sys-x86_64/kernel-offsets.c with 90% similarity]
arch/um/kernel/asm-offsets.c
arch/um/kernel/process_kern.c
arch/um/kernel/skas/process.c
arch/um/kernel/skas/process_kern.c
arch/um/kernel/tt/exec_kern.c
arch/um/kernel/tt/process_kern.c
arch/um/kernel/um_arch.c
arch/v850/kernel/process.c
arch/v850/kernel/ptrace.c
arch/x86_64/Kconfig
arch/x86_64/Makefile
arch/x86_64/defconfig
arch/x86_64/ia32/ia32_binfmt.c
arch/x86_64/ia32/ia32_signal.c
arch/x86_64/ia32/ia32entry.S
arch/x86_64/ia32/ptrace32.c
arch/x86_64/ia32/vsyscall-sigreturn.S
arch/x86_64/ia32/vsyscall-syscall.S
arch/x86_64/ia32/vsyscall-sysenter.S
arch/x86_64/kernel/Makefile
arch/x86_64/kernel/aperture.c
arch/x86_64/kernel/apic.c
arch/x86_64/kernel/asm-offsets.c
arch/x86_64/kernel/early_printk.c
arch/x86_64/kernel/entry.S
arch/x86_64/kernel/genapic_cluster.c
arch/x86_64/kernel/genapic_flat.c
arch/x86_64/kernel/head.S
arch/x86_64/kernel/head64.c
arch/x86_64/kernel/i387.c
arch/x86_64/kernel/i8259.c
arch/x86_64/kernel/io_apic.c
arch/x86_64/kernel/ioport.c
arch/x86_64/kernel/irq.c
arch/x86_64/kernel/kprobes.c
arch/x86_64/kernel/mce.c
arch/x86_64/kernel/mce_amd.c
arch/x86_64/kernel/mce_intel.c
arch/x86_64/kernel/nmi.c
arch/x86_64/kernel/pci-dma.c
arch/x86_64/kernel/pci-gart.c
arch/x86_64/kernel/pci-nommu.c
arch/x86_64/kernel/pci-swiotlb.c [new file with mode: 0644]
arch/x86_64/kernel/process.c
arch/x86_64/kernel/ptrace.c
arch/x86_64/kernel/reboot.c
arch/x86_64/kernel/setup.c
arch/x86_64/kernel/setup64.c
arch/x86_64/kernel/smp.c
arch/x86_64/kernel/smpboot.c
arch/x86_64/kernel/suspend.c
arch/x86_64/kernel/time.c
arch/x86_64/kernel/trampoline.S
arch/x86_64/kernel/traps.c
arch/x86_64/kernel/vmlinux.lds.S
arch/x86_64/kernel/vsmp.c [new file with mode: 0644]
arch/x86_64/kernel/vsyscall.c
arch/x86_64/kernel/x8664_ksyms.c
arch/x86_64/lib/copy_user.S
arch/x86_64/lib/delay.c
arch/x86_64/lib/usercopy.c
arch/x86_64/mm/fault.c
arch/x86_64/mm/init.c
arch/x86_64/mm/numa.c
arch/x86_64/mm/srat.c
arch/x86_64/pci/Makefile-BUS [deleted file]
arch/xtensa/kernel/process.c
arch/xtensa/kernel/ptrace.c
block/elevator.c
block/ioctl.c
block/scsi_ioctl.c
drivers/acorn/char/i2c.c
drivers/acpi/processor_idle.c
drivers/base/firmware_class.c
drivers/base/memory.c
drivers/block/amiflop.c
drivers/block/ataflop.c
drivers/char/amiserial.c
drivers/char/dsp56k.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/random.c
drivers/char/rio/board.h
drivers/char/rio/bootpkt.h
drivers/char/rio/brates.h
drivers/char/rio/chan.h
drivers/char/rio/cirrus.h
drivers/char/rio/cmd.h
drivers/char/rio/cmdblk.h
drivers/char/rio/cmdpkt.h
drivers/char/rio/control.h
drivers/char/rio/daemon.h
drivers/char/rio/debug.h
drivers/char/rio/defaults.h
drivers/char/rio/eisa.h
drivers/char/rio/enable.h
drivers/char/rio/error.h
drivers/char/rio/errors.h
drivers/char/rio/formpkt.h
drivers/char/rio/func.h
drivers/char/rio/host.h
drivers/char/rio/hosthw.h
drivers/char/rio/link.h
drivers/char/rio/linux_compat.h
drivers/char/rio/list.h
drivers/char/rio/lrt.h
drivers/char/rio/ltt.h
drivers/char/rio/lttwake.h
drivers/char/rio/map.h
drivers/char/rio/mca.h
drivers/char/rio/mesg.h
drivers/char/rio/param.h
drivers/char/rio/parmmap.h
drivers/char/rio/pci.h
drivers/char/rio/phb.h
drivers/char/rio/pkt.h
drivers/char/rio/poll.h
drivers/char/rio/port.h
drivers/char/rio/proto.h
drivers/char/rio/protsts.h
drivers/char/rio/qbuf.h
drivers/char/rio/rio.h
drivers/char/rio/rio_linux.c
drivers/char/rio/rio_linux.h
drivers/char/rio/rioboard.h
drivers/char/rio/riocmd.c
drivers/char/rio/rioctrl.c
drivers/char/rio/riodrvr.h
drivers/char/rio/rioinfo.h
drivers/char/rio/riointr.c
drivers/char/rio/rioioctl.h
drivers/char/rio/rioparam.c
drivers/char/rio/riopcicopy.c
drivers/char/rio/rioroute.c
drivers/char/rio/riospace.h
drivers/char/rio/riotable.c
drivers/char/rio/riotime.h
drivers/char/rio/riotty.c
drivers/char/rio/riotypes.h
drivers/char/rio/riowinif.h
drivers/char/rio/riscos.h
drivers/char/rio/rom.h
drivers/char/rio/route.h
drivers/char/rio/rtahw.h
drivers/char/rio/rup.h
drivers/char/rio/rupstat.h
drivers/char/rio/sam.h
drivers/char/rio/selftest.h
drivers/char/rio/space.h
drivers/char/rio/sysmap.h
drivers/char/rio/timeouts.h
drivers/char/rio/top.h
drivers/char/rio/typdef.h
drivers/char/rio/unixrup.h
drivers/char/rtc.c
drivers/char/scc.h
drivers/char/synclink_gt.c
drivers/char/tlclk.c
drivers/char/tty_io.c
drivers/char/viocons.c
drivers/firmware/efivars.c
drivers/input/evdev.c
drivers/input/joystick/amijoy.c
drivers/input/mouse/amimouse.c
drivers/macintosh/adb-iop.c
drivers/macintosh/via-macii.c
drivers/macintosh/via-maciisi.c
drivers/macintosh/via-pmu68k.c
drivers/md/md.c
drivers/media/common/saa7146_core.c
drivers/media/common/saa7146_fops.c
drivers/media/dvb/b2c2/flexcop.c
drivers/media/dvb/bt8xx/dvb-bt8xx.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/dvb/dvb-usb/cxusb.c
drivers/media/dvb/dvb-usb/dtt200u-fe.c
drivers/media/dvb/dvb-usb/dvb-usb-ids.h
drivers/media/dvb/dvb-usb/dvb-usb-init.c
drivers/media/dvb/dvb-usb/dvb-usb-urb.c
drivers/media/dvb/dvb-usb/vp702x-fe.c
drivers/media/dvb/dvb-usb/vp7045-fe.c
drivers/media/dvb/frontends/bcm3510.c
drivers/media/dvb/frontends/dib3000mb.c
drivers/media/dvb/frontends/dib3000mc.c
drivers/media/dvb/frontends/dvb-pll.c
drivers/media/dvb/frontends/dvb-pll.h
drivers/media/dvb/frontends/lgdt330x.c
drivers/media/dvb/frontends/mt352.c
drivers/media/dvb/frontends/nxt200x.c
drivers/media/dvb/pluto2/pluto2.c
drivers/media/dvb/ttpci/av7110.c
drivers/media/dvb/ttpci/budget-av.c
drivers/media/dvb/ttpci/budget.h
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
drivers/media/dvb/ttusb-dec/ttusb_dec.c
drivers/media/radio/radio-gemtek-pci.c
drivers/media/video/Kconfig
drivers/media/video/adv7170.c
drivers/media/video/adv7175.c
drivers/media/video/bt819.c
drivers/media/video/bt832.c
drivers/media/video/bt856.c
drivers/media/video/bttv-cards.c
drivers/media/video/bttv-gpio.c
drivers/media/video/bttv-input.c
drivers/media/video/bttv.h
drivers/media/video/compat_ioctl32.c
drivers/media/video/cpia_pp.c
drivers/media/video/cpia_usb.c
drivers/media/video/cs53l32a.c
drivers/media/video/cx25840/cx25840-core.c
drivers/media/video/cx88/cx88-blackbird.c
drivers/media/video/cx88/cx88-cards.c
drivers/media/video/cx88/cx88-core.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/cx88/cx88-input.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/dpc7146.c
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/hexium_gemini.c
drivers/media/video/hexium_orion.c
drivers/media/video/indycam.c
drivers/media/video/msp3400-driver.c
drivers/media/video/msp3400-kthreads.c
drivers/media/video/msp3400.h
drivers/media/video/mt20xx.c
drivers/media/video/mxb.c
drivers/media/video/ovcamchip/ov6x20.c
drivers/media/video/ovcamchip/ov6x30.c
drivers/media/video/ovcamchip/ov76be.c
drivers/media/video/ovcamchip/ov7x10.c
drivers/media/video/ovcamchip/ov7x20.c
drivers/media/video/ovcamchip/ovcamchip_core.c
drivers/media/video/saa5246a.c
drivers/media/video/saa5249.c
drivers/media/video/saa7110.c
drivers/media/video/saa7111.c
drivers/media/video/saa7114.c
drivers/media/video/saa7115.c
drivers/media/video/saa711x.c
drivers/media/video/saa7127.c
drivers/media/video/saa7134/Kconfig
drivers/media/video/saa7134/saa6752hs.c
drivers/media/video/saa7134/saa7134-cards.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/saa7146.h
drivers/media/video/saa7185.c
drivers/media/video/saa7191.c
drivers/media/video/stradis.c
drivers/media/video/tda7432.c
drivers/media/video/tda9875.c
drivers/media/video/tda9887.c
drivers/media/video/tea5767.c
drivers/media/video/tea6420.c
drivers/media/video/tuner-3036.c
drivers/media/video/tuner-core.c
drivers/media/video/tvaudio.c
drivers/media/video/tveeprom.c
drivers/media/video/tvp5150.c
drivers/media/video/v4l1-compat.c
drivers/media/video/video-buf.c
drivers/media/video/videocodec.c
drivers/media/video/videodev.c
drivers/media/video/vino.c
drivers/media/video/vpx3220.c
drivers/media/video/wm8775.c
drivers/media/video/zoran_card.c
drivers/media/video/zoran_driver.c
drivers/media/video/zr36016.c
drivers/media/video/zr36050.c
drivers/media/video/zr36060.c
drivers/net/Kconfig
drivers/net/cs89x0.c
drivers/net/hplance.c
drivers/net/mac8390.c
drivers/net/sun3lance.c
drivers/oprofile/event_buffer.c
drivers/parisc/led.c
drivers/parisc/pdc_stable.c
drivers/scsi/Makefile
drivers/scsi/NCR53C9x.c
drivers/scsi/blz1230.c
drivers/scsi/blz2060.c
drivers/scsi/cyberstorm.c
drivers/scsi/cyberstormII.c
drivers/scsi/fastlane.c
drivers/scsi/oktagon_esp.c
drivers/scsi/wd33c93.c
drivers/video/amifb.c
drivers/video/aty/atyfb_base.c
drivers/video/macfb.c
drivers/zorro/proc.c
fs/attr.c
fs/autofs/root.c
fs/autofs4/root.c
fs/buffer.c
fs/compat_ioctl.c
fs/dcookies.c
fs/dquot.c
fs/ext2/acl.c
fs/ext2/balloc.c
fs/ext2/ioctl.c
fs/ext2/xattr_trusted.c
fs/ext3/acl.c
fs/ext3/balloc.c
fs/ext3/ioctl.c
fs/ext3/xattr_trusted.c
fs/fat/file.c
fs/fcntl.c
fs/file_table.c
fs/hfsplus/ioctl.c
fs/hugetlbfs/inode.c
fs/ioctl.c
fs/ioprio.c
fs/jffs2/fs.c
fs/jfs/xattr.c
fs/namei.c
fs/namespace.c
fs/ncpfs/ioctl.c
fs/ocfs2/file.c
fs/open.c
fs/proc/base.c
fs/proc/kcore.c
fs/proc/vmcore.c
fs/quota.c
fs/reiserfs/ioctl.c
fs/reiserfs/journal.c
fs/reiserfs/xattr.c
fs/reiserfs/xattr_acl.c
fs/reiserfs/xattr_trusted.c
fs/smbfs/proc.c
fs/sysfs/inode.c
fs/udf/file.c
fs/ufs/balloc.c
fs/xfs/linux-2.6/xfs_cred.h
fs/xfs/linux-2.6/xfs_ioctl.c
fs/xfs/linux-2.6/xfs_iops.c
fs/xfs/quota/xfs_qm_syscalls.c
fs/xfs/xfs_acl.c
fs/xfs/xfs_attr.c
fs/xfs/xfs_vnodeops.c
include/asm-alpha/mmu_context.h
include/asm-alpha/processor.h
include/asm-alpha/ptrace.h
include/asm-alpha/system.h
include/asm-alpha/thread_info.h
include/asm-arm/processor.h
include/asm-arm/system.h
include/asm-arm/thread_info.h
include/asm-arm26/system.h
include/asm-arm26/thread_info.h
include/asm-cris/arch-v10/processor.h
include/asm-cris/arch-v32/processor.h
include/asm-cris/processor.h
include/asm-cris/thread_info.h
include/asm-frv/thread_info.h
include/asm-generic/mutex-dec.h
include/asm-h8300/page.h
include/asm-h8300/thread_info.h
include/asm-i386/apic.h
include/asm-i386/bitops.h
include/asm-i386/cpufeature.h
include/asm-i386/dma-mapping.h
include/asm-i386/i387.h
include/asm-i386/io.h
include/asm-i386/mach-default/mach_ipi.h
include/asm-i386/mutex.h
include/asm-i386/processor.h
include/asm-i386/system.h
include/asm-i386/thread_info.h
include/asm-i386/topology.h
include/asm-ia64/compat.h
include/asm-ia64/processor.h
include/asm-ia64/ptrace.h
include/asm-ia64/system.h
include/asm-ia64/thread_info.h
include/asm-ia64/topology.h
include/asm-m32r/ptrace.h
include/asm-m32r/system.h
include/asm-m32r/thread_info.h
include/asm-m68k/amigahw.h
include/asm-m68k/amigaints.h
include/asm-m68k/checksum.h
include/asm-m68k/dsp56k.h
include/asm-m68k/floppy.h
include/asm-m68k/hardirq.h
include/asm-m68k/io.h
include/asm-m68k/irq.h
include/asm-m68k/machdep.h
include/asm-m68k/raw_io.h
include/asm-m68k/signal.h
include/asm-m68k/sun3_pgtable.h
include/asm-m68k/sun3ints.h
include/asm-m68k/sun3xflop.h
include/asm-m68k/thread_info.h
include/asm-m68k/uaccess.h
include/asm-m68k/zorro.h
include/asm-m68knommu/machdep.h
include/asm-m68knommu/thread_info.h
include/asm-mips/mach-ip27/topology.h
include/asm-mips/processor.h
include/asm-mips/system.h
include/asm-mips/thread_info.h
include/asm-parisc/system.h
include/asm-parisc/thread_info.h
include/asm-powerpc/paca.h
include/asm-powerpc/page.h
include/asm-powerpc/parport.h
include/asm-powerpc/percpu.h
include/asm-powerpc/rtas.h
include/asm-powerpc/system.h
include/asm-powerpc/thread_info.h
include/asm-powerpc/topology.h
include/asm-powerpc/udbg.h
include/asm-ppc/system.h
include/asm-s390/elf.h
include/asm-s390/processor.h
include/asm-s390/system.h
include/asm-s390/thread_info.h
include/asm-sh/ptrace.h
include/asm-sh/system.h
include/asm-sh/thread_info.h
include/asm-sh64/thread_info.h
include/asm-sparc/system.h
include/asm-sparc/thread_info.h
include/asm-sparc64/elf.h
include/asm-sparc64/mmu_context.h
include/asm-sparc64/processor.h
include/asm-sparc64/system.h
include/asm-um/thread_info.h
include/asm-v850/processor.h
include/asm-v850/thread_info.h
include/asm-x86_64/apic.h
include/asm-x86_64/apicdef.h
include/asm-x86_64/atomic.h
include/asm-x86_64/bitops.h
include/asm-x86_64/cache.h
include/asm-x86_64/compat.h
include/asm-x86_64/cpufeature.h
include/asm-x86_64/desc.h
include/asm-x86_64/dma-mapping.h
include/asm-x86_64/dwarf2.h
include/asm-x86_64/gart-mapping.h [new file with mode: 0644]
include/asm-x86_64/hw_irq.h
include/asm-x86_64/i387.h
include/asm-x86_64/idle.h [new file with mode: 0644]
include/asm-x86_64/io.h
include/asm-x86_64/ipi.h
include/asm-x86_64/kdebug.h
include/asm-x86_64/mmu_context.h
include/asm-x86_64/mmzone.h
include/asm-x86_64/mutex.h
include/asm-x86_64/numa.h
include/asm-x86_64/page.h
include/asm-x86_64/pci.h
include/asm-x86_64/pda.h
include/asm-x86_64/percpu.h
include/asm-x86_64/pgtable.h
include/asm-x86_64/processor.h
include/asm-x86_64/proto.h
include/asm-x86_64/segment.h
include/asm-x86_64/smp.h
include/asm-x86_64/swiotlb.h
include/asm-x86_64/system.h
include/asm-x86_64/thread_info.h
include/asm-x86_64/timex.h
include/asm-x86_64/topology.h
include/asm-x86_64/uaccess.h
include/asm-x86_64/vsyscall.h
include/asm-xtensa/processor.h
include/asm-xtensa/ptrace.h
include/asm-xtensa/thread_info.h
include/linux/capability.h
include/linux/dmi.h
include/linux/gfp.h
include/linux/kprobes.h
include/linux/mm.h
include/linux/mmzone.h
include/linux/pci_ids.h
include/linux/sched.h
include/linux/topology.h
include/media/tuner.h
include/media/v4l2-common.h
init/Kconfig
ipc/mqueue.c
ipc/msg.c
ipc/sem.c
ipc/shm.c
ipc/util.c
kernel/acct.c
kernel/capability.c
kernel/exit.c
kernel/fork.c
kernel/kexec.c
kernel/kprobes.c
kernel/module.c
kernel/ptrace.c
kernel/sched.c
kernel/signal.c
kernel/sys.c
kernel/sysctl.c
kernel/time.c
kernel/uid16.c
lib/swiotlb.c
mm/filemap.c
mm/mempolicy.c
mm/mlock.c
mm/mmap.c
mm/mremap.c
mm/page_alloc.c
mm/swapfile.c
mm/tiny-shmem.c
net/8021q/vlan.c
net/appletalk/ddp.c
net/atm/br2684.c
net/atm/clip.c
net/atm/ioctl.c
net/atm/lec.c
net/atm/mpc.c
net/atm/pppoatm.c
net/atm/raw.c
net/atm/resources.c
net/ax25/af_ax25.c
net/ax25/ax25_route.c
net/ax25/ax25_uid.c
net/bluetooth/bnep/sock.c
net/bluetooth/cmtp/sock.c
net/bluetooth/hci_sock.c
net/bluetooth/hidp/sock.c
net/bluetooth/l2cap.c
net/bluetooth/rfcomm/tty.c
net/bridge/br_ioctl.c
net/bridge/br_sysfs_br.c
net/bridge/br_sysfs_if.c
net/bridge/netfilter/ebt_stp.c
net/bridge/netfilter/ebtables.c
net/core/dev.c
net/core/dev_mcast.c
net/core/dv.c
net/core/ethtool.c
net/core/net-sysfs.c
net/core/pktgen.c
net/core/scm.c
net/core/sock.c
net/decnet/af_decnet.c
net/decnet/dn_dev.c
net/ipv4/af_inet.c
net/ipv4/arp.c
net/ipv4/devinet.c
net/ipv4/fib_frontend.c
net/ipv4/igmp.c
net/ipv4/ip_gre.c
net/ipv4/ip_options.c
net/ipv4/ip_sockglue.c
net/ipv4/ipip.c
net/ipv4/ipmr.c
net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_conntrack_helper_pptp.c
net/ipv4/netfilter/ip_conntrack_proto_gre.c
net/ipv4/netfilter/ip_tables.c
net/ipv6/addrconf.c
net/ipv6/af_inet6.c
net/ipv6/anycast.c
net/ipv6/datagram.c
net/ipv6/ip6_flowlabel.c
net/ipv6/ip6_tunnel.c
net/ipv6/ipv6_sockglue.c
net/ipv6/mcast.c
net/ipv6/netfilter/ip6_tables.c
net/ipv6/netfilter/ip6t_mac.c
net/ipv6/route.c
net/ipv6/sit.c
net/ipv6/tcp_ipv6.c
net/ipx/af_ipx.c
net/irda/af_irda.c
net/irda/irda_device.c
net/irda/irias_object.c
net/irda/irnet/irnet.h
net/key/af_key.c
net/netlink/af_netlink.c
net/netrom/af_netrom.c
net/packet/af_packet.c
net/rose/af_rose.c
net/sched/Kconfig
net/sched/ematch.c
net/sctp/sm_make_chunk.c
net/sctp/socket.c
net/socket.c
net/sunrpc/auth.c
net/sunrpc/auth_unix.c
net/sunrpc/clnt.c
net/sunrpc/svc.c
net/wanrouter/af_wanpipe.c
net/wanrouter/wanmain.c
net/x25/af_x25.c
security/commoncap.c
security/dummy.c
security/keys/keyctl.c
security/security.c
sound/oss/dmasound/dmasound.h
sound/oss/dmasound/dmasound_atari.c
sound/oss/dmasound/dmasound_paula.c
sound/oss/dmasound/dmasound_q40.c
sound/oss/dmasound/trans_16.c
sound/oss/i810_audio.c
sound/pci/emu10k1/emufx.c

index f4d0de6bac636306135b1ae19dd003a1f6adf67b..afb1335c05d6fb5db31402dcd33c9a1ff21fb275 100644 (file)
@@ -84,8 +84,6 @@ reservation
 
 noreservation
 
-resize=
-
 bsddf          (*)     Make 'df' act like BSD.
 minixdf                        Make 'df' act like Minix.
 
@@ -175,6 +173,7 @@ See manual pages to learn more.
 tune2fs:       create a ext3 journal on a ext2 partition with the -j flag.
 mke2fs:        create a ext3 partition with the -j flag.
 debugfs:       ext2 and ext3 file system debugger.
+ext2online:    online (mounted) ext2 and ext3 filesystem resizer
 
 
 References
@@ -184,6 +183,7 @@ kernel source:      <file:fs/ext3/>
                <file:fs/jbd/>
 
 programs:      http://e2fsprogs.sourceforge.net/
+               http://ext2resize.sourceforge.net
 
 useful links:  http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html
                http://www-106.ibm.com/developerworks/linux/library/l-fs7/
index bc1b9eb92ae129982ad34d6dbac4c61dbd58861b..dcf5580380ab3c848f185ed15df95b25b24b2037 100644 (file)
@@ -177,3 +177,25 @@ document trapinfo
        'trapinfo <pid>' will tell you by which trap & possibly
        addresthe kernel paniced.
 end
+
+
+define dmesg
+       set $i = 0
+       set $end_idx = (log_end - 1) & (log_buf_len - 1)
+
+       while ($i < logged_chars)
+               set $idx = (log_end - 1 - logged_chars + $i) & (log_buf_len - 1)
+
+               if ($idx + 100 <= $end_idx) || \
+                  ($end_idx <= $idx && $idx + 100 < log_buf_len)
+                       printf "%.100s", &log_buf[$idx]
+                       set $i = $i + 100
+               else
+                       printf "%c", log_buf[$idx]
+                       set $i = $i + 1
+               end
+       end
+end
+document dmesg
+       print the kernel ring buffer
+end
index dd0bfc291a682e60c39441d07ef0be026dceabee..fe11fccf7e41bd7bb1abd38be8c73cb52775cc2d 100644 (file)
@@ -856,6 +856,49 @@ running once the system is up.
 
        mga=            [HW,DRM]
 
+       migration_cost=
+                       [KNL,SMP] debug: override scheduler migration costs
+                       Format: <level-1-usecs>,<level-2-usecs>,...
+                       This debugging option can be used to override the
+                       default scheduler migration cost matrix. The numbers
+                       are indexed by 'CPU domain distance'.
+                       E.g. migration_cost=1000,2000,3000 on an SMT NUMA
+                       box will set up an intra-core migration cost of
+                       1 msec, an inter-core migration cost of 2 msecs,
+                       and an inter-node migration cost of 3 msecs.
+
+                       WARNING: using the wrong values here can break
+                       scheduler performance, so it's only for scheduler
+                       development purposes, not production environments.
+
+       migration_debug=
+                       [KNL,SMP] migration cost auto-detect verbosity
+                       Format=<0|1|2>
+                       If a system's migration matrix reported at bootup
+                       seems erroneous then this option can be used to
+                       increase verbosity of the detection process.
+                       We default to 0 (no extra messages), 1 will print
+                       some more information, and 2 will be really
+                       verbose (probably only useful if you also have a
+                       serial console attached to the system).
+
+       migration_factor=
+                       [KNL,SMP] multiply/divide migration costs by a factor
+                       Format=<percent>
+                       This debug option can be used to proportionally
+                       increase or decrease the auto-detected migration
+                       costs for all entries of the migration matrix.
+                       E.g. migration_factor=150 will increase migration
+                       costs by 50%. (and thus the scheduler will be less
+                       eager migrating cache-hot tasks)
+                       migration_factor=80 will decrease migration costs
+                       by 20%. (thus the scheduler will be more eager to
+                       migrate tasks)
+
+                       WARNING: using the wrong values here can break
+                       scheduler performance, so it's only for scheduler
+                       development purposes, not production environments.
+
        mousedev.tap_time=
                        [MOUSE] Maximum time between finger touching and
                        leaving touchpad surface for touch to be considered
index 05960f8a748e6169822b1954530150502135cde0..2503404ae5c26bce481d56daecb008588e86102e 100644 (file)
@@ -41,11 +41,9 @@ the disk is not available then you have three options :-
     run a null modem to a second machine and capture the output there
     using your favourite communication program.  Minicom works well.
 
-(3) Patch the kernel with one of the crash dump patches.  These save
-    data to a floppy disk or video rom or a swap partition.  None of
-    these are standard kernel patches so you have to find and apply
-    them yourself.  Search kernel archives for kmsgdump, lkcd and
-    oops+smram.
+(3) Use Kdump (see Documentation/kdump/kdump.txt),
+    extract the kernel ring buffer from old memory with using dmesg
+    gdbmacro in Documentation/kdump/gdbmacros.txt.
 
 
 Full Information
index 74fb085e178b9da6c37cd3efa0224626665ec371..b72706c58a442bdb744fb34f74340b1de0337b29 100644 (file)
 141 -> Asound Skyeye PCTV
 142 -> Sabrent TV-FM (bttv version)
 143 -> Hauppauge ImpactVCB (bt878)                         [0070:13eb]
+144 -> MagicTV
index 34b6e59f2968244421e23739d852b69610f83393..56e194f1a0b06ec52b4daf6702d52289901bc250 100644 (file)
@@ -19,7 +19,7 @@
  18 -> Hauppauge Nova-T DVB-T                              [0070:9002,0070:9001]
  19 -> Conexant DVB-T reference design                     [14f1:0187]
  20 -> Provideo PV259                                      [1540:2580]
- 21 -> DViCO FusionHDTV DVB-T Plus                         [18ac:db10]
+ 21 -> DViCO FusionHDTV DVB-T Plus                         [18ac:db10,18ac:db11]
  22 -> pcHDTV HD3000 HDTV                                  [7063:3000]
  23 -> digitalnow DNTV Live! DVB-T                         [17de:a8a6]
  24 -> Hauppauge WinTV 28xxx (Roslyn) models               [0070:2801]
index e566affeed7f49e7b3a66f4d516a9c380805d63a..72ab9b99b22c822f160f7e95fdd5d2d4613c3ee9 100644 (file)
@@ -125,7 +125,7 @@ SMP
   cpumask=MASK   only use cpus with bits set in mask
 
   additional_cpus=NUM Allow NUM more CPUs for hotplug
-                (defaults are specified by the BIOS or half the available CPUs)
+                (defaults are specified by the BIOS, see Documentation/x86_64/cpu-hotplug-spec)
 
 NUMA
 
diff --git a/Documentation/x86_64/cpu-hotplug-spec b/Documentation/x86_64/cpu-hotplug-spec
new file mode 100644 (file)
index 0000000..5c0fa34
--- /dev/null
@@ -0,0 +1,21 @@
+Firmware support for CPU hotplug under Linux/x86-64
+---------------------------------------------------
+
+Linux/x86-64 supports CPU hotplug now. For various reasons Linux wants to
+know in advance boot time the maximum number of CPUs that could be plugged
+into the system. ACPI 3.0 currently has no official way to supply
+this information from the firmware to the operating system.
+
+In ACPI each CPU needs an LAPIC object in the MADT table (5.2.11.5 in the
+ACPI 3.0 specification).  ACPI already has the concept of disabled LAPIC
+objects by setting the Enabled bit in the LAPIC object to zero.
+
+For CPU hotplug Linux/x86-64 expects now that any possible future hotpluggable
+CPU is already available in the MADT. If the CPU is not available yet
+it should have its LAPIC Enabled bit set to 0. Linux will use the number
+of disabled LAPICs to compute the maximum number of future CPUs.
+
+In the worst case the user can overwrite this choice using a command line
+option (additional_cpus=...), but it is recommended to supply the correct
+number (or a reasonable approximation of it, with erring towards more not less)
+in the MADT to avoid manual configuration.
index b6416a293ec93793be0d5b5e838637fa5eab8f39..0db72a36e2453e1f47007a6db14ad37ae3004829 100644 (file)
@@ -2359,13 +2359,6 @@ P:       Nicolas Pitre
 M:     nico@cam.org
 S:     Maintained
 
-SNA NETWORK LAYER
-P:     Jay Schulist
-M:     jschlst@samba.org
-L:     linux-sna@turbolinux.com
-W:     http://www.linux-sna.org
-S:     Supported
-
 SOFTWARE RAID (Multiple Disks) SUPPORT
 P:     Ingo Molnar
 M:     mingo@redhat.com
index 9903e3a79102486184dc66e282fab60a9048fe6d..fff5cf93e8164a6a465f5c538d16350d271307e0 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
+#include <linux/capability.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
index abb739b88ed15603400495cd6cadab48ff63a1ac..9924fd07743abfd5bb4cda9e78ac3e58ca72a9d7 100644 (file)
@@ -276,7 +276,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 {
        extern void ret_from_fork(void);
 
-       struct thread_info *childti = p->thread_info;
+       struct thread_info *childti = task_thread_info(p);
        struct pt_regs * childregs;
        struct switch_stack * childstack, *stack;
        unsigned long stack_offset, settls;
@@ -285,7 +285,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
        if (!(regs->ps & 8))
                stack_offset = (PAGE_SIZE-1) & (unsigned long) regs;
        childregs = (struct pt_regs *)
-         (stack_offset + PAGE_SIZE + (long) childti);
+         (stack_offset + PAGE_SIZE + task_stack_page(p));
                
        *childregs = *regs;
        settls = regs->r20;
@@ -428,30 +428,15 @@ dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt, struct thread_info *ti)
 int
 dump_elf_task(elf_greg_t *dest, struct task_struct *task)
 {
-       struct thread_info *ti;
-       struct pt_regs *pt;
-
-       ti = task->thread_info;
-       pt = (struct pt_regs *)((unsigned long)ti + 2*PAGE_SIZE) - 1;
-
-       dump_elf_thread(dest, pt, ti);
-
+       dump_elf_thread(dest, task_pt_regs(task), task_thread_info(task));
        return 1;
 }
 
 int
 dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task)
 {
-       struct thread_info *ti;
-       struct pt_regs *pt;
-       struct switch_stack *sw;
-
-       ti = task->thread_info;
-       pt = (struct pt_regs *)((unsigned long)ti + 2*PAGE_SIZE) - 1;
-       sw = (struct switch_stack *)pt - 1;
-
+       struct switch_stack *sw = (struct switch_stack *)task_pt_regs(task) - 1;
        memcpy(dest, sw->fp, 32 * 8);
-
        return 1;
 }
 
@@ -492,8 +477,8 @@ out:
 unsigned long
 thread_saved_pc(task_t *t)
 {
-       unsigned long base = (unsigned long)t->thread_info;
-       unsigned long fp, sp = t->thread_info->pcb.ksp;
+       unsigned long base = (unsigned long)task_stack_page(t);
+       unsigned long fp, sp = task_thread_info(t)->pcb.ksp;
 
        if (sp > base && sp+6*8 < base + 16*1024) {
                fp = ((unsigned long*)sp)[6];
@@ -523,7 +508,7 @@ get_wchan(struct task_struct *p)
 
        pc = thread_saved_pc(p);
        if (in_sched_functions(pc)) {
-               schedule_frame = ((unsigned long *)p->thread_info->pcb.ksp)[6];
+               schedule_frame = ((unsigned long *)task_thread_info(p)->pcb.ksp)[6];
                return ((unsigned long *)schedule_frame)[12];
        }
        return pc;
index 9969d212e94d9d4b16da2f66921f8b206822612e..0cd060598f9aa25aee8d86a6629cc4d8514542ed 100644 (file)
@@ -72,6 +72,13 @@ enum {
        REG_R0 = 0, REG_F0 = 32, REG_FPCR = 63, REG_PC = 64
 };
 
+#define PT_REG(reg) \
+  (PAGE_SIZE*2 - sizeof(struct pt_regs) + offsetof(struct pt_regs, reg))
+
+#define SW_REG(reg) \
+ (PAGE_SIZE*2 - sizeof(struct pt_regs) - sizeof(struct switch_stack) \
+  + offsetof(struct switch_stack, reg))
+
 static int regoff[] = {
        PT_REG(    r0), PT_REG(    r1), PT_REG(    r2), PT_REG(   r3),
        PT_REG(    r4), PT_REG(    r5), PT_REG(    r6), PT_REG(   r7),
@@ -103,14 +110,14 @@ get_reg_addr(struct task_struct * task, unsigned long regno)
        unsigned long *addr;
 
        if (regno == 30) {
-               addr = &task->thread_info->pcb.usp;
+               addr = &task_thread_info(task)->pcb.usp;
        } else if (regno == 65) {
-               addr = &task->thread_info->pcb.unique;
+               addr = &task_thread_info(task)->pcb.unique;
        } else if (regno == 31 || regno > 65) {
                zero = 0;
                addr = &zero;
        } else {
-               addr = (void *)task->thread_info + regoff[regno];
+               addr = task_stack_page(task) + regoff[regno];
        }
        return addr;
 }
@@ -125,7 +132,7 @@ get_reg(struct task_struct * task, unsigned long regno)
        if (regno == 63) {
                unsigned long fpcr = *get_reg_addr(task, regno);
                unsigned long swcr
-                 = task->thread_info->ieee_state & IEEE_SW_MASK;
+                 = task_thread_info(task)->ieee_state & IEEE_SW_MASK;
                swcr = swcr_update_status(swcr, fpcr);
                return fpcr | swcr;
        }
@@ -139,8 +146,8 @@ static int
 put_reg(struct task_struct *task, unsigned long regno, unsigned long data)
 {
        if (regno == 63) {
-               task->thread_info->ieee_state
-                 = ((task->thread_info->ieee_state & ~IEEE_SW_MASK)
+               task_thread_info(task)->ieee_state
+                 = ((task_thread_info(task)->ieee_state & ~IEEE_SW_MASK)
                     | (data & IEEE_SW_MASK));
                data = (data & FPCR_DYN_MASK) | ieee_swcr_to_fpcr(data);
        }
@@ -188,35 +195,35 @@ ptrace_set_bpt(struct task_struct * child)
                 * branch (emulation can be tricky for fp branches).
                 */
                displ = ((s32)(insn << 11)) >> 9;
-               child->thread_info->bpt_addr[nsaved++] = pc + 4;
+               task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
                if (displ)              /* guard against unoptimized code */
-                       child->thread_info->bpt_addr[nsaved++]
+                       task_thread_info(child)->bpt_addr[nsaved++]
                          = pc + 4 + displ;
                DBG(DBG_BPT, ("execing branch\n"));
        } else if (op_code == 0x1a) {
                reg_b = (insn >> 16) & 0x1f;
-               child->thread_info->bpt_addr[nsaved++] = get_reg(child, reg_b);
+               task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b);
                DBG(DBG_BPT, ("execing jump\n"));
        } else {
-               child->thread_info->bpt_addr[nsaved++] = pc + 4;
+               task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
                DBG(DBG_BPT, ("execing normal insn\n"));
        }
 
        /* install breakpoints: */
        for (i = 0; i < nsaved; ++i) {
-               res = read_int(child, child->thread_info->bpt_addr[i],
+               res = read_int(child, task_thread_info(child)->bpt_addr[i],
                               (int *) &insn);
                if (res < 0)
                        return res;
-               child->thread_info->bpt_insn[i] = insn;
+               task_thread_info(child)->bpt_insn[i] = insn;
                DBG(DBG_BPT, ("    -> next_pc=%lx\n",
-                             child->thread_info->bpt_addr[i]));
-               res = write_int(child, child->thread_info->bpt_addr[i],
+                             task_thread_info(child)->bpt_addr[i]));
+               res = write_int(child, task_thread_info(child)->bpt_addr[i],
                                BREAKINST);
                if (res < 0)
                        return res;
        }
-       child->thread_info->bpt_nsaved = nsaved;
+       task_thread_info(child)->bpt_nsaved = nsaved;
        return 0;
 }
 
@@ -227,9 +234,9 @@ ptrace_set_bpt(struct task_struct * child)
 int
 ptrace_cancel_bpt(struct task_struct * child)
 {
-       int i, nsaved = child->thread_info->bpt_nsaved;
+       int i, nsaved = task_thread_info(child)->bpt_nsaved;
 
-       child->thread_info->bpt_nsaved = 0;
+       task_thread_info(child)->bpt_nsaved = 0;
 
        if (nsaved > 2) {
                printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
@@ -237,8 +244,8 @@ ptrace_cancel_bpt(struct task_struct * child)
        }
 
        for (i = 0; i < nsaved; ++i) {
-               write_int(child, child->thread_info->bpt_addr[i],
-                         child->thread_info->bpt_insn[i]);
+               write_int(child, task_thread_info(child)->bpt_addr[i],
+                         task_thread_info(child)->bpt_insn[i]);
        }
        return (nsaved != 0);
 }
@@ -355,7 +362,7 @@ do_sys_ptrace(long request, long pid, long addr, long data,
                if (!valid_signal(data))
                        break;
                /* Mark single stepping.  */
-               child->thread_info->bpt_nsaved = -1;
+               task_thread_info(child)->bpt_nsaved = -1;
                clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
                child->exit_code = data;
                wake_up_process(child);
index da0be34657915beec4cab3beeb15af6d33e0956c..4b873527ce1c56d354e86ddabb5825ba3d345f0a 100644 (file)
@@ -302,7 +302,7 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
                 + hwrpb->processor_offset
                 + cpuid * hwrpb->processor_size);
        hwpcb = (struct pcb_struct *) cpu->hwpcb;
-       ipcb = &idle->thread_info->pcb;
+       ipcb = &task_thread_info(idle)->pcb;
 
        /* Initialize the CPU's HWPCB to something just good enough for
           us to get started.  Immediately after starting, we'll swpctx
index 72b03f201eb946f97c9f419090d683ece6ea5bc1..ffb82d5bedefaff24f5deb53e6215b16f333e65a 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/proc_fs.h>
 #include <linux/miscdevice.h>
 #include <linux/spinlock.h>
+#include <linux/capability.h>
 #include <linux/device.h>
 
 #include <asm/rtc.h>
index b9df1b782bb1128b72b30739dbc92671d14c8d2e..766b6c05c6db6a2cf9d97e4a0f8d4a84f475f63b 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/proc_fs.h>
 #include <linux/miscdevice.h>
 #include <linux/apm_bios.h>
+#include <linux/capability.h>
 #include <linux/sched.h>
 #include <linux/pm.h>
 #include <linux/device.h>
index 54a21bdcba5cde6fe94bc1d56a3e083b5ac68af6..4b4e4cf79c8070e0cfd055bdf3a72a93efd61027 100644 (file)
@@ -342,10 +342,10 @@ void flush_thread(void)
 void release_thread(struct task_struct *dead_task)
 {
 #if defined(CONFIG_VFP)
-       vfp_release_thread(&dead_task->thread_info->vfpstate);
+       vfp_release_thread(&task_thread_info(dead_task)->vfpstate);
 #endif
 #if defined(CONFIG_IWMMXT)
-       iwmmxt_task_release(dead_task->thread_info);
+       iwmmxt_task_release(task_thread_info(dead_task));
 #endif
 }
 
@@ -355,10 +355,9 @@ int
 copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start,
            unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs)
 {
-       struct thread_info *thread = p->thread_info;
-       struct pt_regs *childregs;
+       struct thread_info *thread = task_thread_info(p);
+       struct pt_regs *childregs = task_pt_regs(p);
 
-       childregs = (void *)thread + THREAD_START_SP - sizeof(*regs);
        *childregs = *regs;
        childregs->ARM_r0 = 0;
        childregs->ARM_sp = stack_start;
@@ -460,8 +459,8 @@ unsigned long get_wchan(struct task_struct *p)
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;
 
-       stack_start = (unsigned long)(p->thread_info + 1);
-       stack_end = ((unsigned long)p->thread_info) + THREAD_SIZE;
+       stack_start = (unsigned long)end_of_stack(p);
+       stack_end = (unsigned long)task_stack_page(p) + THREAD_SIZE;
 
        fp = thread_saved_fp(p);
        do {
index 2b84f78d7b0f78585698e54bf137f3cde7634205..e591f72bcdeb0abf8d6714e94219de4cdc2d7720 100644 (file)
 #define BREAKINST_THUMB        0xde01
 #endif
 
-/*
- * Get the address of the live pt_regs for the specified task.
- * These are saved onto the top kernel stack when the process
- * is not running.
- *
- * Note: if a user thread is execve'd from kernel space, the
- * kernel stack will not be empty on entry to the kernel, so
- * ptracing these tasks will fail.
- */
-static inline struct pt_regs *
-get_user_regs(struct task_struct *task)
-{
-       return (struct pt_regs *)
-               ((unsigned long)task->thread_info + THREAD_SIZE -
-                                8 - sizeof(struct pt_regs));
-}
-
 /*
  * this routine will get a word off of the processes privileged stack.
  * the offset is how far from the base addr as stored in the THREAD.
@@ -79,7 +62,7 @@ get_user_regs(struct task_struct *task)
  */
 static inline long get_user_reg(struct task_struct *task, int offset)
 {
-       return get_user_regs(task)->uregs[offset];
+       return task_pt_regs(task)->uregs[offset];
 }
 
 /*
@@ -91,7 +74,7 @@ static inline long get_user_reg(struct task_struct *task, int offset)
 static inline int
 put_user_reg(struct task_struct *task, int offset, long data)
 {
-       struct pt_regs newregs, *regs = get_user_regs(task);
+       struct pt_regs newregs, *regs = task_pt_regs(task);
        int ret = -EINVAL;
 
        newregs = *regs;
@@ -421,7 +404,7 @@ void ptrace_set_bpt(struct task_struct *child)
        u32 insn;
        int res;
 
-       regs = get_user_regs(child);
+       regs = task_pt_regs(child);
        pc = instruction_pointer(regs);
 
        if (thumb_mode(regs)) {
@@ -572,7 +555,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
  */
 static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
 {
-       struct pt_regs *regs = get_user_regs(tsk);
+       struct pt_regs *regs = task_pt_regs(tsk);
 
        return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
 }
@@ -587,7 +570,7 @@ static int ptrace_setregs(struct task_struct *tsk, void __user *uregs)
 
        ret = -EFAULT;
        if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
-               struct pt_regs *regs = get_user_regs(tsk);
+               struct pt_regs *regs = task_pt_regs(tsk);
 
                ret = -EINVAL;
                if (valid_user_regs(&newregs)) {
@@ -604,7 +587,7 @@ static int ptrace_setregs(struct task_struct *tsk, void __user *uregs)
  */
 static int ptrace_getfpregs(struct task_struct *tsk, void __user *ufp)
 {
-       return copy_to_user(ufp, &tsk->thread_info->fpstate,
+       return copy_to_user(ufp, &task_thread_info(tsk)->fpstate,
                            sizeof(struct user_fp)) ? -EFAULT : 0;
 }
 
@@ -613,7 +596,7 @@ static int ptrace_getfpregs(struct task_struct *tsk, void __user *ufp)
  */
 static int ptrace_setfpregs(struct task_struct *tsk, void __user *ufp)
 {
-       struct thread_info *thread = tsk->thread_info;
+       struct thread_info *thread = task_thread_info(tsk);
        thread->used_cp[1] = thread->used_cp[2] = 1;
        return copy_from_user(&thread->fpstate, ufp,
                              sizeof(struct user_fp)) ? -EFAULT : 0;
@@ -626,7 +609,7 @@ static int ptrace_setfpregs(struct task_struct *tsk, void __user *ufp)
  */
 static int ptrace_getwmmxregs(struct task_struct *tsk, void __user *ufp)
 {
-       struct thread_info *thread = tsk->thread_info;
+       struct thread_info *thread = task_thread_info(tsk);
        void *ptr = &thread->fpstate;
 
        if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT))
@@ -643,7 +626,7 @@ static int ptrace_getwmmxregs(struct task_struct *tsk, void __user *ufp)
  */
 static int ptrace_setwmmxregs(struct task_struct *tsk, void __user *ufp)
 {
-       struct thread_info *thread = tsk->thread_info;
+       struct thread_info *thread = task_thread_info(tsk);
        void *ptr = &thread->fpstate;
 
        if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT))
@@ -779,7 +762,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
 #endif
 
                case PTRACE_GET_THREAD_AREA:
-                       ret = put_user(child->thread_info->tp_value,
+                       ret = put_user(task_thread_info(child)->tp_value,
                                       (unsigned long __user *) data);
                        break;
 
index 373c0959bc2f64ff02e72610e3091f53b6cd9763..7338948bd7d38046e355807e73c44413d3db40d7 100644 (file)
@@ -114,7 +114,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
         * We need to tell the secondary core where to find
         * its stack and the page tables.
         */
-       secondary_data.stack = (void *)idle->thread_info + THREAD_START_SP;
+       secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
        secondary_data.pgdir = virt_to_phys(pgd);
        wmb();
 
@@ -245,7 +245,7 @@ void __cpuexit cpu_die(void)
        __asm__("mov    sp, %0\n"
        "       b       secondary_start_kernel"
                :
-               : "r" ((void *)current->thread_info + THREAD_SIZE - 8));
+               : "r" (task_stack_page(current) + THREAD_SIZE - 8));
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
index c9fe6f5f7ee35ac6df900efcf06c85cd908e3a15..93cfd3ffcc72b6cbc90ff6c7ff8f808b15e3ea15 100644 (file)
@@ -164,7 +164,7 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
        } else if (verify_stack(fp)) {
                printk("invalid frame pointer 0x%08x", fp);
                ok = 0;
-       } else if (fp < (unsigned long)(tsk->thread_info + 1))
+       } else if (fp < (unsigned long)end_of_stack(tsk))
                printk("frame pointer underflow");
        printk("\n");
 
@@ -210,7 +210,7 @@ static void __die(const char *str, int err, struct thread_info *thread, struct p
 
        if (!user_mode(regs) || in_interrupt()) {
                dump_mem("Stack: ", regs->ARM_sp,
-                        THREAD_SIZE + (unsigned long)tsk->thread_info);
+                        THREAD_SIZE + (unsigned long)task_stack_page(tsk));
                dump_backtrace(regs, tsk);
                dump_instr(regs);
        }
index 15833a0057dd1c9ad7360275cd81b4e1716d053b..38630565917142c4b4bb2c5017141e71ecfb06cc 100644 (file)
@@ -277,10 +277,9 @@ int
 copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start,
            unsigned long unused, struct task_struct *p, struct pt_regs *regs)
 {
-       struct thread_info *thread = p->thread_info;
-       struct pt_regs *childregs;
+       struct thread_info *thread = task_thread_info(p);
+       struct pt_regs *childregs = task_pt_regs(p);
 
-       childregs = __get_user_regs(thread);
        *childregs = *regs;
        childregs->ARM_r0 = 0;
        childregs->ARM_sp = stack_start;
index 4e6b7356a7221a29c20faa79299ba118bd9cfebe..3c3371d4683edd2ed5c6afa300cfcc91ae41fa36 100644 (file)
  */
 #define BREAKINST_ARM  0xef9f0001
 
-/*
- * Get the address of the live pt_regs for the specified task.
- * These are saved onto the top kernel stack when the process
- * is not running.
- *
- * Note: if a user thread is execve'd from kernel space, the
- * kernel stack will not be empty on entry to the kernel, so
- * ptracing these tasks will fail.
- */
-static inline struct pt_regs *
-get_user_regs(struct task_struct *task)
-{
-       return __get_user_regs(task->thread_info);
-}
-
 /*
  * this routine will get a word off of the processes privileged stack.
  * the offset is how far from the base addr as stored in the THREAD.
@@ -62,7 +47,7 @@ get_user_regs(struct task_struct *task)
  */
 static inline long get_user_reg(struct task_struct *task, int offset)
 {
-       return get_user_regs(task)->uregs[offset];
+       return task_pt_regs(task)->uregs[offset];
 }
 
 /*
@@ -74,7 +59,7 @@ static inline long get_user_reg(struct task_struct *task, int offset)
 static inline int
 put_user_reg(struct task_struct *task, int offset, long data)
 {
-       struct pt_regs newregs, *regs = get_user_regs(task);
+       struct pt_regs newregs, *regs = task_pt_regs(task);
        int ret = -EINVAL;
 
        newregs = *regs;
@@ -377,7 +362,7 @@ void ptrace_set_bpt(struct task_struct *child)
        u32 insn;
        int res;
 
-       regs = get_user_regs(child);
+       regs = task_pt_regs(child);
        pc = instruction_pointer(regs);
 
        res = read_instr(child, pc, &insn);
@@ -500,7 +485,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
  */
 static int ptrace_getregs(struct task_struct *tsk, void *uregs)
 {
-       struct pt_regs *regs = get_user_regs(tsk);
+       struct pt_regs *regs = task_pt_regs(tsk);
 
        return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
 }
@@ -515,7 +500,7 @@ static int ptrace_setregs(struct task_struct *tsk, void *uregs)
 
        ret = -EFAULT;
        if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
-               struct pt_regs *regs = get_user_regs(tsk);
+               struct pt_regs *regs = task_pt_regs(tsk);
 
                ret = -EINVAL;
                if (valid_user_regs(&newregs)) {
@@ -532,7 +517,7 @@ static int ptrace_setregs(struct task_struct *tsk, void *uregs)
  */
 static int ptrace_getfpregs(struct task_struct *tsk, void *ufp)
 {
-       return copy_to_user(ufp, &tsk->thread_info->fpstate,
+       return copy_to_user(ufp, &task_thread_info(tsk)->fpstate,
                            sizeof(struct user_fp)) ? -EFAULT : 0;
 }
 
@@ -542,7 +527,7 @@ static int ptrace_getfpregs(struct task_struct *tsk, void *ufp)
 static int ptrace_setfpregs(struct task_struct *tsk, void *ufp)
 {
        set_stopped_child_used_math(tsk);
-       return copy_from_user(&tsk->thread_info->fpstate, ufp,
+       return copy_from_user(&task_threas_info(tsk)->fpstate, ufp,
                              sizeof(struct user_fp)) ? -EFAULT : 0;
 }
 
index f64f59022392894d473722099553afff21fd9d13..5847ea5d7747f6f73dd86bbd6f18af2eaa930ef9 100644 (file)
@@ -132,7 +132,7 @@ static void dump_instr(struct pt_regs *regs)
 
 /*static*/ void __dump_stack(struct task_struct *tsk, unsigned long sp)
 {
-       dump_mem("Stack: ", sp, 8192+(unsigned long)tsk->thread_info);
+       dump_mem("Stack: ", sp, 8192+(unsigned long)task_stack_page(tsk));
 }
 
 void dump_stack(void)
@@ -158,7 +158,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
        } else if (verify_stack(fp)) {
                printk("invalid frame pointer 0x%08x", fp);
                ok = 0;
-       } else if (fp < (unsigned long)(tsk->thread_info + 1))
+       } else if (fp < (unsigned long)end_of_stack(tsk))
                printk("frame pointer underflow");
        printk("\n");
 
@@ -168,7 +168,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
 
 /* FIXME - this is probably wrong.. */
 void show_stack(struct task_struct *task, unsigned long *sp) {
-       dump_mem("Stack: ", (unsigned long)sp, 8192+(unsigned long)task->thread_info);
+       dump_mem("Stack: ", (unsigned long)sp, 8192+(unsigned long)task_stack_page(task));
 }
 
 DEFINE_SPINLOCK(die_lock);
@@ -187,7 +187,7 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
        printk("CPU: %d\n", smp_processor_id());
        show_regs(regs);
        printk("Process %s (pid: %d, stack limit = 0x%p)\n",
-               current->comm, current->pid, tsk->thread_info + 1);
+               current->comm, current->pid, end_of_stack(tsk));
 
        if (!user_mode(regs) || in_interrupt()) {
                __dump_stack(tsk, (unsigned long)(regs + 1));
index 10795f67f6878a52410bf5baea22b09076597d52..b100f26497c4e4b430d1cf8699d52ce43faffae5 100644 (file)
 #include <linux/miscdevice.h>
 #include <linux/delay.h>
 #include <linux/bcd.h>
+#include <linux/capability.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
index f2c55742e90c2ce1c8ccadd9f22b14e57b365d3c..af517c210383478c14c0a09e607e6d26a06a8a6b 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/ioctl.h>
 #include <linux/delay.h>
 #include <linux/bcd.h>
+#include <linux/capability.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
index 69e28b4057e8bc00f7ea93f4b756a589f20fbd32..0a675ce9e0992895f809b3898084efbd8b973ea6 100644 (file)
@@ -79,7 +79,7 @@ void hard_reset_now (void)
  */
 unsigned long thread_saved_pc(struct task_struct *t)
 {
-       return (unsigned long)user_regs(t->thread_info)->irp;
+       return task_pt_regs(t)->irp;
 }
 
 static void kernel_thread_helper(void* dummy, int (*fn)(void *), void * arg)
@@ -128,7 +128,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
         * remember that the task_struct doubles as the kernel stack for the task
         */
 
-       childregs = user_regs(p->thread_info);        
+       childregs = task_pt_regs(p);
         
        *childregs = *regs;  /* struct copy of pt_regs */
         
index 6cbd34a27b906cdce1805b710eedca1cd6cfa566..f214f74f264e43a65415d490a640ae31364a94de 100644 (file)
@@ -37,7 +37,7 @@ inline long get_reg(struct task_struct *task, unsigned int regno)
        if (regno == PT_USP)
                return task->thread.usp;
        else if (regno < PT_MAX)
-               return ((unsigned long *)user_regs(task->thread_info))[regno];
+               return ((unsigned long *)task_pt_regs(task))[regno];
        else
                return 0;
 }
@@ -51,7 +51,7 @@ inline int put_reg(struct task_struct *task, unsigned int regno,
        if (regno == PT_USP)
                task->thread.usp = data;
        else if (regno < PT_MAX)
-               ((unsigned long *)user_regs(task->thread_info))[regno] = data;
+               ((unsigned long *)task_pt_regs(task))[regno] = data;
        else
                return -1;
        return 0;
index 882be42114f749a625f9a48c9ede2c70009b6f05..843513102d3cfcbb94404b0a56edd08daa6b9178 100644 (file)
@@ -96,7 +96,7 @@ hard_reset_now(void)
  */
 unsigned long thread_saved_pc(struct task_struct *t)
 {
-       return (unsigned long)user_regs(t->thread_info)->erp;
+       return task_pt_regs(t)->erp;
 }
 
 static void
@@ -148,7 +148,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
         * fix it up. Note: the task_struct doubles as the kernel stack for the
         * task.
         */
-       childregs = user_regs(p->thread_info);
+       childregs = task_pt_regs(p);
        *childregs = *regs;     /* Struct copy of pt_regs. */
         p->set_child_tid = p->clear_child_tid = NULL;
         childregs->r10 = 0;    /* Child returns 0 after a fork/clone. */
@@ -157,7 +157,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
         * The TLS is in $mof beacuse it is the 5th argument to sys_clone.
         */
        if (p->mm && (clone_flags & CLONE_SETTLS)) {
-               p->thread_info->tls = regs->mof;
+               task_thread_info(p)->tls = regs->mof;
        }
 
        /* Put the switch stack right below the pt_regs. */
index 5528b83a622b62e666f2e4241967353724f47f7e..82cf2e3624a41e93a1b748c671406f62043876bc 100644 (file)
@@ -46,7 +46,7 @@ long get_reg(struct task_struct *task, unsigned int regno)
        unsigned long ret;
 
        if (regno <= PT_EDA)
-               ret = ((unsigned long *)user_regs(task->thread_info))[regno];
+               ret = ((unsigned long *)task_pt_regs(task))[regno];
        else if (regno == PT_USP)
                ret = task->thread.usp;
        else if (regno == PT_PPC)
@@ -65,13 +65,13 @@ long get_reg(struct task_struct *task, unsigned int regno)
 int put_reg(struct task_struct *task, unsigned int regno, unsigned long data)
 {
        if (regno <= PT_EDA)
-               ((unsigned long *)user_regs(task->thread_info))[regno] = data;
+               ((unsigned long *)task_pt_regs(task))[regno] = data;
        else if (regno == PT_USP)
                task->thread.usp = data;
        else if (regno == PT_PPC) {
                /* Write pseudo-PC to ERP only if changed. */
                if (data != get_pseudo_pc(task))
-                       ((unsigned long *)user_regs(task->thread_info))[PT_ERP] = data;
+                       task_pt_regs(task)->erp = data;
        } else if (regno <= PT_MAX)
                return put_debugreg(task->pid, regno, data);
        else
index 13867f4fad16a858a13d4305a3869998ef516b78..da40d19a151e28a76b7814a8e1d9ac6805a35c4c 100644 (file)
@@ -113,10 +113,10 @@ smp_boot_one_cpu(int cpuid)
        if (IS_ERR(idle))
                panic("SMP: fork failed for CPU:%d", cpuid);
 
-       idle->thread_info->cpu = cpuid;
+       task_thread_info(idle)->cpu = cpuid;
 
        /* Information to the CPU that is about to boot */
-       smp_init_current_idle_thread = idle->thread_info;
+       smp_init_current_idle_thread = task_thread_info(idle);
        cpu_now_booting = cpuid;
 
        /* Wait for CPU to come online */
index b08a28bb58abab021e9dcd263067b6a5abd55a5b..9d75d7692303fca512713743952403f07cab07fe 100644 (file)
@@ -198,9 +198,9 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
        per_cpu(current_pgd, cpu) = next->pgd;
 
        /* Switch context in the MMU. */
-        if (tsk && tsk->thread_info)
+        if (tsk && task_thread_info(tsk))
         {
-          SPEC_REG_WR(SPEC_REG_PID, next->context.page_id | tsk->thread_info->tls);
+          SPEC_REG_WR(SPEC_REG_PID, next->context.page_id | task_thread_info(tsk)->tls);
         }
         else
         {
index c4488379ac3bf022998274d629f78baccb03f513..0fff8a61ef2a8ba2032ebfb50cfb553ff94cc97b 100644 (file)
@@ -204,7 +204,7 @@ int copy_thread(int nr, unsigned long clone_flags,
 
        regs0 = __kernel_frame0_ptr;
        childregs0 = (struct pt_regs *)
-               ((unsigned long) p->thread_info + THREAD_SIZE - USER_CONTEXT_SIZE);
+               (task_stack_page(p) + THREAD_SIZE - USER_CONTEXT_SIZE);
        childregs = childregs0;
 
        /* set up the userspace frame (the only place that the USP is stored) */
@@ -220,7 +220,7 @@ int copy_thread(int nr, unsigned long clone_flags,
                *childregs = *regs;
                childregs->sp = (unsigned long) childregs0;
                childregs->next_frame = childregs0;
-               childregs->gr15 = (unsigned long) p->thread_info;
+               childregs->gr15 = (unsigned long) task_thread_info(p);
                childregs->gr29 = (unsigned long) p;
        }
 
index 585ed5efd0f719fa5d490c6f65a7fb318dbf5550..ed79ae20e88d4a58800da6204648820bd6171666 100644 (file)
@@ -195,7 +195,7 @@ int copy_thread(int nr, unsigned long clone_flags,
 {
        struct pt_regs * childregs;
 
-       childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
+       childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1;
 
        *childregs = *regs;
        childregs->retpc = (unsigned long) ret_from_fork;
index 815878ebd30f0d9e1699d040e45b854320ab054a..d5d0df7f04fcbcf631d9c22884552f4bedaffaea 100644 (file)
@@ -41,8 +41,21 @@ config ARCH_MAY_HAVE_PC_FDC
        bool
        default y
 
+config DMI
+       bool
+       default y
+
 source "init/Kconfig"
 
+config DOUBLEFAULT
+       default y
+       bool "Enable doublefault exception handler" if EMBEDDED
+       help
+          This option allows trapping of rare doublefault exceptions that
+          would otherwise cause a system to silently reboot. Disabling this
+          option saves about 4k and might cause you much additional grey
+          hair.
+
 menu "Processor type and features"
 
 choice
index 447fa9e33ffbeaaca7bbee58621900cbf0ba2b1e..2111529dea77821ff595ce4a21edb369102b9b93 100644 (file)
@@ -108,7 +108,7 @@ char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
        if (!phys_addr || !size)
                return NULL;
 
-       if (phys_addr < (end_pfn_map << PAGE_SHIFT))
+       if (phys_addr+size <= (end_pfn_map << PAGE_SHIFT) + PAGE_SIZE)
                return __va(phys_addr);
 
        return NULL;
index d8f94e78de8ab293465a32ebeb6af15a7e0d1554..acd3f1e34ca6661c331edd0f0369e93da7a744b3 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/kernel_stat.h>
 #include <linux/sysdev.h>
 #include <linux/cpu.h>
+#include <linux/module.h>
 
 #include <asm/atomic.h>
 #include <asm/smp.h>
 #include <asm/i8253.h>
 
 #include <mach_apic.h>
+#include <mach_ipi.h>
 
 #include "io_ports.h"
 
+/*
+ * cpu_mask that denotes the CPUs that needs timer interrupt coming in as
+ * IPIs in place of local APIC timers
+ */
+static cpumask_t timer_bcast_ipi;
+
 /*
  * Knob to control our willingness to enable the local APIC.
  */
@@ -92,10 +100,6 @@ void __init apic_intr_init(void)
 /* Using APIC to generate smp_local_timer_interrupt? */
 int using_apic_timer = 0;
 
-static DEFINE_PER_CPU(int, prof_multiplier) = 1;
-static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
-static DEFINE_PER_CPU(int, prof_counter) = 1;
-
 static int enabled_via_apicbase;
 
 void enable_NMI_through_LVT0 (void * dummy)
@@ -935,11 +939,16 @@ void (*wait_timer_tick)(void) __devinitdata = wait_8254_wraparound;
 static void __setup_APIC_LVTT(unsigned int clocks)
 {
        unsigned int lvtt_value, tmp_value, ver;
+       int cpu = smp_processor_id();
 
        ver = GET_APIC_VERSION(apic_read(APIC_LVR));
        lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR;
        if (!APIC_INTEGRATED(ver))
                lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV);
+
+       if (cpu_isset(cpu, timer_bcast_ipi))
+               lvtt_value |= APIC_LVT_MASKED;
+
        apic_write_around(APIC_LVTT, lvtt_value);
 
        /*
@@ -1072,7 +1081,7 @@ void __devinit setup_secondary_APIC_clock(void)
        setup_APIC_timer(calibration_result);
 }
 
-void __devinit disable_APIC_timer(void)
+void disable_APIC_timer(void)
 {
        if (using_apic_timer) {
                unsigned long v;
@@ -1084,7 +1093,10 @@ void __devinit disable_APIC_timer(void)
 
 void enable_APIC_timer(void)
 {
-       if (using_apic_timer) {
+       int cpu = smp_processor_id();
+
+       if (using_apic_timer &&
+           !cpu_isset(cpu, timer_bcast_ipi)) {
                unsigned long v;
 
                v = apic_read(APIC_LVTT);
@@ -1092,33 +1104,31 @@ void enable_APIC_timer(void)
        }
 }
 
-/*
- * the frequency of the profiling timer can be changed
- * by writing a multiplier value into /proc/profile.
- */
-int setup_profiling_timer(unsigned int multiplier)
+void switch_APIC_timer_to_ipi(void *cpumask)
 {
-       int i;
+       cpumask_t mask = *(cpumask_t *)cpumask;
+       int cpu = smp_processor_id();
 
-       /*
-        * Sanity check. [at least 500 APIC cycles should be
-        * between APIC interrupts as a rule of thumb, to avoid
-        * irqs flooding us]
-        */
-       if ( (!multiplier) || (calibration_result/multiplier < 500))
-               return -EINVAL;
-
-       /* 
-        * Set the new multiplier for each CPU. CPUs don't start using the
-        * new values until the next timer interrupt in which they do process
-        * accounting. At that time they also adjust their APIC timers
-        * accordingly.
-        */
-       for (i = 0; i < NR_CPUS; ++i)
-               per_cpu(prof_multiplier, i) = multiplier;
+       if (cpu_isset(cpu, mask) &&
+           !cpu_isset(cpu, timer_bcast_ipi)) {
+               disable_APIC_timer();
+               cpu_set(cpu, timer_bcast_ipi);
+       }
+}
+EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
 
-       return 0;
+void switch_ipi_to_APIC_timer(void *cpumask)
+{
+       cpumask_t mask = *(cpumask_t *)cpumask;
+       int cpu = smp_processor_id();
+
+       if (cpu_isset(cpu, mask) &&
+           cpu_isset(cpu, timer_bcast_ipi)) {
+               cpu_clear(cpu, timer_bcast_ipi);
+               enable_APIC_timer();
+       }
 }
+EXPORT_SYMBOL(switch_ipi_to_APIC_timer);
 
 #undef APIC_DIVISOR
 
@@ -1134,32 +1144,10 @@ int setup_profiling_timer(unsigned int multiplier)
 
 inline void smp_local_timer_interrupt(struct pt_regs * regs)
 {
-       int cpu = smp_processor_id();
-
        profile_tick(CPU_PROFILING, regs);
-       if (--per_cpu(prof_counter, cpu) <= 0) {
-               /*
-                * The multiplier may have changed since the last time we got
-                * to this point as a result of the user writing to
-                * /proc/profile. In this case we need to adjust the APIC
-                * timer accordingly.
-                *
-                * Interrupts are already masked off at this point.
-                */
-               per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
-               if (per_cpu(prof_counter, cpu) !=
-                                       per_cpu(prof_old_multiplier, cpu)) {
-                       __setup_APIC_LVTT(
-                                       calibration_result/
-                                       per_cpu(prof_counter, cpu));
-                       per_cpu(prof_old_multiplier, cpu) =
-                                               per_cpu(prof_counter, cpu);
-               }
-
 #ifdef CONFIG_SMP
-               update_process_times(user_mode_vm(regs));
+       update_process_times(user_mode_vm(regs));
 #endif
-       }
 
        /*
         * We take the 'long' return path, and there every subsystem
@@ -1206,6 +1194,43 @@ fastcall void smp_apic_timer_interrupt(struct pt_regs *regs)
        irq_exit();
 }
 
+#ifndef CONFIG_SMP
+static void up_apic_timer_interrupt_call(struct pt_regs *regs)
+{
+       int cpu = smp_processor_id();
+
+       /*
+        * the NMI deadlock-detector uses this.
+        */
+       per_cpu(irq_stat, cpu).apic_timer_irqs++;
+
+       smp_local_timer_interrupt(regs);
+}
+#endif
+
+void smp_send_timer_broadcast_ipi(struct pt_regs *regs)
+{
+       cpumask_t mask;
+
+       cpus_and(mask, cpu_online_map, timer_bcast_ipi);
+       if (!cpus_empty(mask)) {
+#ifdef CONFIG_SMP
+               send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
+#else
+               /*
+                * We can directly call the apic timer interrupt handler
+                * in UP case. Minus all irq related functions
+                */
+               up_apic_timer_interrupt_call(regs);
+#endif
+       }
+}
+
+int setup_profiling_timer(unsigned int multiplier)
+{
+       return -EINVAL;
+}
+
 /*
  * This interrupt should _never_ happen with our APIC/SMP architecture
  */
index 9d8827156e54ad7ea6832f97d34e116f89d14ac1..05312a8abb8b6e3d0b5de7ff74a73d14392fc828 100644 (file)
 #include <linux/sched.h>
 #include <linux/pm.h>
 #include <linux/pm_legacy.h>
+#include <linux/capability.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/smp.h>
index e7697e077f6bce7895a560cfdc049be3a914f8f4..333578a4e91afcf768a5dc35e10188a76c06591f 100644 (file)
@@ -216,6 +216,12 @@ static void __init init_amd(struct cpuinfo_x86 *c)
                        c->x86_max_cores = 1;
        }
 
+       if (cpuid_eax(0x80000000) >= 0x80000007) {
+               c->x86_power = cpuid_edx(0x80000007);
+               if (c->x86_power & (1<<8))
+                       set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
+       }
+
 #ifdef CONFIG_X86_HT
        /*
         * On a AMD dual core setup the lower bits of the APIC id
@@ -233,6 +239,7 @@ static void __init init_amd(struct cpuinfo_x86 *c)
                       cpu, c->x86_max_cores, cpu_core_id[cpu]);
        }
 #endif
+
 }
 
 static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size)
index 170400879f448dff13106e1b9f94e1bd645c8117..15aee26ec2b6308be3d9e9f7e0e47f120be11fe1 100644 (file)
@@ -204,7 +204,10 @@ static int __devinit have_cpuid_p(void)
 
 /* Do minimum CPU detection early.
    Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment.
-   The others are not touched to avoid unwanted side effects. */
+   The others are not touched to avoid unwanted side effects.
+
+   WARNING: this function is only called on the BP.  Don't add code here
+   that is supposed to run on all CPUs. */
 static void __init early_cpu_detect(void)
 {
        struct cpuinfo_x86 *c = &boot_cpu_data;
@@ -236,12 +239,6 @@ static void __init early_cpu_detect(void)
                if (cap0 & (1<<19))
                        c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8;
        }
-
-       early_intel_workaround(c);
-
-#ifdef CONFIG_X86_HT
-       phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
-#endif
 }
 
 void __devinit generic_identify(struct cpuinfo_x86 * c)
@@ -289,6 +286,12 @@ void __devinit generic_identify(struct cpuinfo_x86 * c)
                                get_model_name(c); /* Default name */
                }
        }
+
+       early_intel_workaround(c);
+
+#ifdef CONFIG_X86_HT
+       phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
+#endif
 }
 
 static void __devinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c)
index 871366b83b3f40cbc38ee91ec099e6cf3e5e15d0..7975e79d5fa4e6e607117bc7b5b2fbd7e0e37389 100644 (file)
@@ -40,8 +40,6 @@
 #include <linux/acpi.h>
 #include <acpi/processor.h>
 
-#include "speedstep-est-common.h"
-
 #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg)
 
 MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski");
@@ -367,6 +365,7 @@ acpi_cpufreq_cpu_init (
        unsigned int            cpu = policy->cpu;
        struct cpufreq_acpi_io  *data;
        unsigned int            result = 0;
+       struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
 
        union acpi_object               arg0 = {ACPI_TYPE_BUFFER};
        u32                             arg0_buf[3];
@@ -390,7 +389,7 @@ acpi_cpufreq_cpu_init (
        if (result)
                goto err_free;
 
-       if (is_const_loops_cpu(cpu)) {
+       if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
                acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
        }
 
index edb9873e27e37fbb7ee1f66c89c5e87436bec3bd..9a826cde4fd1074838faf4b3890a59567b96a7bf 100644 (file)
@@ -35,8 +35,6 @@
 #include <asm/processor.h>
 #include <asm/cpufeature.h>
 
-#include "speedstep-est-common.h"
-
 #define PFX            "speedstep-centrino: "
 #define MAINTAINER     "Jeremy Fitzhardinge <jeremy@goop.org>"
 
@@ -493,12 +491,13 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
        unsigned l, h;
        int ret;
        int i;
+       struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
 
        /* Only Intel makes Enhanced Speedstep-capable CPUs */
        if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST))
                return -ENODEV;
 
-       if (is_const_loops_cpu(policy->cpu)) {
+       if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
                centrino_driver.flags |= CPUFREQ_CONST_LOOPS;
        }
 
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h b/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h
deleted file mode 100644 (file)
index 5ce995c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Routines common for drivers handling Enhanced Speedstep Technology
- *  Copyright (C) 2004 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
- *
- *  Licensed under the terms of the GNU GPL License version 2 -- see
- *  COPYING for details.
- */
-
-static inline int is_const_loops_cpu(unsigned int cpu)
-{
-       struct cpuinfo_x86      *c = cpu_data + cpu;
-
-       if (c->x86_vendor != X86_VENDOR_INTEL || !cpu_has(c, X86_FEATURE_EST))
-               return 0;
-
-       /*
-        * on P-4s, the TSC runs with constant frequency independent of cpu freq
-        * when we use EST
-        */
-       if (c->x86 == 0xf)
-               return 1;
-
-       return 0;
-}
-
index 5e2da704f0faa8200fa744e39d8ffb86dd860542..8c0120186b9fc6ba5ef5ea932df98098667135d2 100644 (file)
@@ -183,10 +183,13 @@ static void __devinit init_intel(struct cpuinfo_x86 *c)
        }
 #endif
 
-       if (c->x86 == 15) 
+       if (c->x86 == 15)
                set_bit(X86_FEATURE_P4, c->x86_capability);
        if (c->x86 == 6) 
                set_bit(X86_FEATURE_P3, c->x86_capability);
+       if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
+               (c->x86 == 0x6 && c->x86_model >= 0x0e))
+               set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
 }
 
 
index cf39e205d33ca2a7192bf284a573d5d39b711ee9..5ac051bb9d55e36b4daf4a1a06e072992728d18e 100644 (file)
@@ -1,5 +1,6 @@
 #include <linux/init.h>
 #include <linux/proc_fs.h>
+#include <linux/capability.h>
 #include <linux/ctype.h>
 #include <linux/module.h>
 #include <linux/seq_file.h>
index 6d91b274589c7fff2bef8e0d35aaa90c41de71a6..89a85af33d28f48573117bb004a290d52e668fbb 100644 (file)
@@ -29,7 +29,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL,
-               NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow",
+               NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow",
 
                /* Transmeta-defined */
                "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -40,7 +40,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                /* Other (Linux-defined) */
                "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
                NULL, NULL, NULL, NULL,
-               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+               "constant_tsc", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
@@ -57,11 +57,21 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
                /* AMD-defined (#2) */
-               "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL,
+               "lahf_lm", "cmp_legacy", "svm", NULL, "cr8legacy", NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        };
+       static char *x86_power_flags[] = {
+               "ts",   /* temperature sensor */
+               "fid",  /* frequency id control */
+               "vid",  /* voltage id control */
+               "ttp",  /* thermal trip */
+               "tm",
+               "stc",
+               NULL,
+               /* nothing */   /* constant_tsc - moved to flags */
+       };
        struct cpuinfo_x86 *c = v;
        int i, n = c - cpu_data;
        int fpu_exception;
@@ -131,6 +141,17 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                     x86_cap_flags[i] != NULL )
                        seq_printf(m, " %s", x86_cap_flags[i]);
 
+       for (i = 0; i < 32; i++)
+               if (c->x86_power & (1 << i)) {
+                       if (i < ARRAY_SIZE(x86_power_flags) &&
+                           x86_power_flags[i])
+                               seq_printf(m, "%s%s",
+                                          x86_power_flags[i][0]?" ":"",
+                                          x86_power_flags[i]);
+                       else
+                               seq_printf(m, " [%d]", i);
+               }
+
        seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n",
                     c->loops_per_jiffy/(500000/HZ),
                     (c->loops_per_jiffy/(5000/HZ)) % 100);
index 58516e2ac1728fb4cbeb31e7dae8e23d237f5e27..6a93d75db4313a5b3355c0b2896917b13f0c32f8 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/module.h>
 #include <linux/dmi.h>
 #include <linux/bootmem.h>
-
+#include <linux/slab.h>
 
 static char * __init dmi_string(struct dmi_header *dm, u8 s)
 {
@@ -19,7 +19,7 @@ static char * __init dmi_string(struct dmi_header *dm, u8 s)
                }
 
                if (*bp != 0) {
-                       str = alloc_bootmem(strlen(bp) + 1);
+                       str = dmi_alloc(strlen(bp) + 1);
                        if (str != NULL)
                                strcpy(str, bp);
                        else
@@ -40,7 +40,7 @@ static int __init dmi_table(u32 base, int len, int num,
        u8 *buf, *data;
        int i = 0;
                
-       buf = bt_ioremap(base, len);
+       buf = dmi_ioremap(base, len);
        if (buf == NULL)
                return -1;
 
@@ -65,7 +65,7 @@ static int __init dmi_table(u32 base, int len, int num,
                data += 2;
                i++;
        }
-       bt_iounmap(buf, len);
+       dmi_iounmap(buf, len);
        return 0;
 }
 
@@ -112,7 +112,7 @@ static void __init dmi_save_devices(struct dmi_header *dm)
                if ((*d & 0x80) == 0)
                        continue;
 
-               dev = alloc_bootmem(sizeof(*dev));
+               dev = dmi_alloc(sizeof(*dev));
                if (!dev) {
                        printk(KERN_ERR "dmi_save_devices: out of memory.\n");
                        break;
@@ -131,7 +131,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm)
        struct dmi_device *dev;
        void * data;
 
-       data = alloc_bootmem(dm->length);
+       data = dmi_alloc(dm->length);
        if (data == NULL) {
                printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
                return;
@@ -139,7 +139,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm)
 
        memcpy(data, dm, dm->length);
 
-       dev = alloc_bootmem(sizeof(*dev));
+       dev = dmi_alloc(sizeof(*dev));
        if (!dev) {
                printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
                return;
@@ -221,7 +221,7 @@ void __init dmi_scan_machine(void)
                }
        }
 
-out:   printk(KERN_INFO "DMI not present.\n");
+out:   printk(KERN_INFO "DMI not present or invalid.\n");
 }
 
 
index 7554f8fd874ac2dddefaed39edb0857bf6c1b589..f2dd218d88cb64b9fe4bfa083134e7c63a9684b2 100644 (file)
@@ -1649,7 +1649,7 @@ static void __init enable_IO_APIC(void)
        for(apic = 0; apic < nr_ioapics; apic++) {
                int pin;
                /* See if any of the pins is in ExtINT mode */
-               for(pin = 0; pin < nr_ioapic_registers[i]; pin++) {
+               for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
                        struct IO_APIC_route_entry entry;
                        spin_lock_irqsave(&ioapic_lock, flags);
                        *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
index b59a34dbe262d4c3c039608bd27cef3974bfe234..79026f026b85401ee42c3e83bd55c1029e3286e8 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/sched.h>
 #include <linux/kernel.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/ioport.h>
index 2f372dbd34fd54a80c77b6a6380fc5794b3ba781..6483eeb1a4e809f3fef395af0dd151528520c9a4 100644 (file)
@@ -188,6 +188,19 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
                        kcb->kprobe_status = KPROBE_REENTER;
                        return 1;
                } else {
+                       if (regs->eflags & VM_MASK) {
+                       /* We are in virtual-8086 mode. Return 0 */
+                               goto no_kprobe;
+                       }
+                       if (*addr != BREAKPOINT_INSTRUCTION) {
+                       /* The breakpoint instruction was removed by
+                        * another cpu right after we hit, no further
+                        * handling of this interrupt is appropriate
+                        */
+                               regs->eip -= sizeof(kprobe_opcode_t);
+                               ret = 1;
+                               goto no_kprobe;
+                       }
                        p = __get_cpu_var(current_kprobe);
                        if (p->break_handler && p->break_handler(p, regs)) {
                                goto ss_probe;
index 165f13158c60c188a63ddd22530b9bf2bc160108..d3fdf0057d82bec9adaccb5555dcdb5af6bf0135 100644 (file)
@@ -70,6 +70,7 @@
  */
 
 //#define DEBUG /* pr_debug */
+#include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/sched.h>
@@ -165,7 +166,7 @@ static void collect_cpu_info (void *unused)
 
        wrmsr(MSR_IA32_UCODE_REV, 0, 0);
        /* see notes above for revision 1.07.  Apparent chip bug */
-       serialize_cpu();
+       sync_core();
        /* get the current revision from MSR 0x8B */
        rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev);
        pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n",
@@ -379,7 +380,7 @@ static void do_update_one (void * unused)
        wrmsr(MSR_IA32_UCODE_REV, 0, 0);
 
        /* see notes above for revision 1.07.  Apparent chip bug */
-       serialize_cpu();
+       sync_core();
 
        /* get the current revision from MSR 0x8B */
        rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
index 035928f3f6c1c96bf8869c9388f275fd49db703c..2185377fdde118424aaa36b3b3d8c36498373161 100644 (file)
@@ -424,18 +424,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
        struct task_struct *tsk;
        int err;
 
-       childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
-       /*
-        * The below -8 is to reserve 8 bytes on top of the ring0 stack.
-        * This is necessary to guarantee that the entire "struct pt_regs"
-        * is accessable even if the CPU haven't stored the SS/ESP registers
-        * on the stack (interrupt gate does not save these registers
-        * when switching to the same priv ring).
-        * Therefore beware: accessing the xss/esp fields of the
-        * "struct pt_regs" is possible, but they may contain the
-        * completely wrong values.
-        */
-       childregs = (struct pt_regs *) ((unsigned long) childregs - 8);
+       childregs = task_pt_regs(p);
        *childregs = *regs;
        childregs->eax = 0;
        childregs->esp = esp;
@@ -540,12 +529,7 @@ EXPORT_SYMBOL(dump_thread);
  */
 int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
 {
-       struct pt_regs ptregs;
-       
-       ptregs = *(struct pt_regs *)
-               ((unsigned long)tsk->thread_info +
-               /* see comments in copy_thread() about -8 */
-               THREAD_SIZE - sizeof(ptregs) - 8);
+       struct pt_regs ptregs = *task_pt_regs(tsk);
        ptregs.xcs &= 0xffff;
        ptregs.xds &= 0xffff;
        ptregs.xes &= 0xffff;
@@ -601,8 +585,8 @@ static inline void disable_tsc(struct task_struct *prev_p,
         * gcc should eliminate the ->thread_info dereference if
         * has_secure_computing returns 0 at compile time (SECCOMP=n).
         */
-       prev = prev_p->thread_info;
-       next = next_p->thread_info;
+       prev = task_thread_info(prev_p);
+       next = task_thread_info(next_p);
 
        if (has_secure_computing(prev) || has_secure_computing(next)) {
                /* slow path here */
@@ -787,7 +771,7 @@ unsigned long get_wchan(struct task_struct *p)
        int count = 0;
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;
-       stack_page = (unsigned long)p->thread_info;
+       stack_page = (unsigned long)task_stack_page(p);
        esp = p->thread.esp;
        if (!stack_page || esp < stack_page || esp > top_esp+stack_page)
                return 0;
index 2fa5803a759d26f1b3b6f5f1b1855da8bbf18848..d207242976d31f8be7127f8db18aede33041867e 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/efi.h>
 #include <linux/dmi.h>
 #include <linux/ctype.h>
+#include <linux/pm.h>
 #include <asm/uaccess.h>
 #include <asm/apic.h>
 #include <asm/desc.h>
@@ -355,10 +356,10 @@ void machine_halt(void)
 
 void machine_power_off(void)
 {
-       machine_shutdown();
-
-       if (pm_power_off)
+       if (pm_power_off) {
+               machine_shutdown();
                pm_power_off();
+       }
 }
 
 
index f685637a100d7ab266f013ed7973197be297d6bc..51e513b4f72d02db2e5c2dcac9b09d905c9854ed 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/nodemask.h>
 #include <linux/kexec.h>
 #include <linux/crash_dump.h>
+#include <linux/dmi.h>
 
 #include <video/edid.h>
 
@@ -146,7 +147,6 @@ EXPORT_SYMBOL(ist_info);
 struct e820map e820;
 
 extern void early_cpu_init(void);
-extern void dmi_scan_machine(void);
 extern void generic_apic_probe(char *);
 extern int root_mountflags;
 
@@ -1584,7 +1584,7 @@ void __init setup_arch(char **cmdline_p)
                if (s) {
                        extern void setup_early_printk(char *);
 
-                       setup_early_printk(s);
+                       setup_early_printk(strchr(s, '=') + 1);
                        printk("early console enabled\n");
                }
        }
index b3c2e2c26743381e5f1a8b3dfd592c2c0cb5d2c9..255adb498268bd0f27b0020fd4402682d0432a1a 100644 (file)
@@ -875,8 +875,7 @@ static inline struct task_struct * alloc_idle_task(int cpu)
                /* initialize thread_struct.  we really want to avoid destroy
                 * idle tread
                 */
-               idle->thread.esp = (unsigned long)(((struct pt_regs *)
-                       (THREAD_SIZE + (unsigned long) idle->thread_info)) - 1);
+               idle->thread.esp = (unsigned long)task_pt_regs(idle);
                init_idle(idle, cpu);
                return idle;
        }
@@ -1096,6 +1095,7 @@ static void smp_tune_scheduling (void)
                        cachesize = 16; /* Pentiums, 2x8kB cache */
                        bandwidth = 100;
                }
+               max_cache_size = cachesize * 1024;
        }
 }
 
index 41c5b2dc6200b0a600a830f42121e2290d5b29d6..a14d594bfbebb2b9345e45619fb4387154057653 100644 (file)
@@ -302,6 +302,12 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        do_timer_interrupt(irq, regs);
 
        write_sequnlock(&xtime_lock);
+
+#ifdef CONFIG_X86_LOCAL_APIC
+       if (using_apic_timer)
+               smp_send_timer_broadcast_ipi(regs);
+#endif
+
        return IRQ_HANDLED;
 }
 
index fc1993564f98c35a4ca31902ca01fa3a1f9a8664..0c90ae54ddfa0a868f5df45c23bc738b2d7591dc 100644 (file)
@@ -30,6 +30,7 @@
  *
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
@@ -310,7 +311,7 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
                "movl %1,%%ebp\n\t"
                "jmp resume_userspace"
                : /* no outputs */
-               :"r" (&info->regs), "r" (tsk->thread_info) : "ax");
+               :"r" (&info->regs), "r" (task_thread_info(tsk)) : "ax");
        /* we never return here */
 }
 
index 19ee635eeb707566daa0e3b8d5eafd895490a2a9..a346e1833bf2335b224a298469911233dab809fa 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include <linux/capability.h>
 #include <linux/console.h>
 #include <linux/module.h>
 #include <linux/serial.h>
index b73b8b6b10c13adc3cd0dd3abf140c5cdbc6fe7a..a47f63b204fbbc8d1cf02b982dab0d2992aeac0d 100644 (file)
@@ -95,8 +95,7 @@ static inline void elf_core_copy_regs(elf_gregset_t *elfregs,
 static inline int elf_core_copy_task_regs(struct task_struct *t,
                                          elf_gregset_t* elfregs)
 {
-       struct pt_regs *pp = ia64_task_regs(t);
-       ELF_CORE_COPY_REGS((*elfregs), pp);
+       ELF_CORE_COPY_REGS((*elfregs), task_pt_regs(t));
        return 1;
 }
 
index aa891c9bc9b67ac268970391f49122f37af4b22a..5856510210fac55247f15294469103c55d49dc6c 100644 (file)
@@ -255,7 +255,7 @@ save_ia32_fpstate_live (struct _fpstate_ia32 __user *save)
         */
        fp_tos = (fsr>>11)&0x7;
        fr8_st_map = (8-fp_tos)&0x7;
-       ptp = ia64_task_regs(tsk);
+       ptp = task_pt_regs(tsk);
        fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15);
        ia64f2ia32f(fpregp, &ptp->f8);
        copy_to_user(&save->_st[(0+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
@@ -389,7 +389,7 @@ restore_ia32_fpstate_live (struct _fpstate_ia32 __user *save)
        fr8_st_map = (8-fp_tos)&0x7;
        fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15);
 
-       ptp = ia64_task_regs(tsk);
+       ptp = task_pt_regs(tsk);
        copy_from_user(fpregp, &save->_st[(0+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
        ia32f2ia64f(&ptp->f8, fpregp);
        copy_from_user(fpregp, &save->_st[(1+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
index 4f630043b3aedeb8933b74d5ca7fb78b1210d300..c187743965a02029df7090843ae30e2059afe4d6 100644 (file)
@@ -58,7 +58,7 @@ load_desc (u16 selector)
 void
 ia32_load_segment_descriptors (struct task_struct *task)
 {
-       struct pt_regs *regs = ia64_task_regs(task);
+       struct pt_regs *regs = task_pt_regs(task);
 
        /* Setup the segment descriptors */
        regs->r24 = load_desc(regs->r16 >> 16);         /* ESD */
@@ -113,7 +113,7 @@ void
 ia32_load_state (struct task_struct *t)
 {
        unsigned long eflag, fsr, fcr, fir, fdr, tssd;
-       struct pt_regs *regs = ia64_task_regs(t);
+       struct pt_regs *regs = task_pt_regs(t);
 
        eflag = t->thread.eflag;
        fsr = t->thread.fsr;
index 5ea38286d8d5856dc5005a4f159295c834322f9c..3945d378bd7ed913f7c530dc3135828580ff50bc 100644 (file)
@@ -48,6 +48,7 @@
 #include <linux/ptrace.h>
 #include <linux/stat.h>
 #include <linux/ipc.h>
+#include <linux/capability.h>
 #include <linux/compat.h>
 #include <linux/vfs.h>
 #include <linux/mman.h>
@@ -1481,7 +1482,7 @@ getreg (struct task_struct *child, int regno)
 {
        struct pt_regs *child_regs;
 
-       child_regs = ia64_task_regs(child);
+       child_regs = task_pt_regs(child);
        switch (regno / sizeof(int)) {
              case PT_EBX: return child_regs->r11;
              case PT_ECX: return child_regs->r9;
@@ -1509,7 +1510,7 @@ putreg (struct task_struct *child, int regno, unsigned int value)
 {
        struct pt_regs *child_regs;
 
-       child_regs = ia64_task_regs(child);
+       child_regs = task_pt_regs(child);
        switch (regno / sizeof(int)) {
              case PT_EBX: child_regs->r11 = value; break;
              case PT_ECX: child_regs->r9 = value; break;
@@ -1625,7 +1626,7 @@ save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __user
         *  Stack frames start with 16-bytes of temp space
         */
        swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-       ptp = ia64_task_regs(tsk);
+       ptp = task_pt_regs(tsk);
        tos = (tsk->thread.fsr >> 11) & 7;
        for (i = 0; i < 8; i++)
                put_fpreg(i, &save->st_space[i], ptp, swp, tos);
@@ -1658,7 +1659,7 @@ restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __us
         *  Stack frames start with 16-bytes of temp space
         */
        swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-       ptp = ia64_task_regs(tsk);
+       ptp = task_pt_regs(tsk);
        tos = (tsk->thread.fsr >> 11) & 7;
        for (i = 0; i < 8; i++)
                get_fpreg(i, &save->st_space[i], ptp, swp, tos);
@@ -1689,7 +1690,7 @@ save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __user
          *  Stack frames start with 16-bytes of temp space
          */
         swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-        ptp = ia64_task_regs(tsk);
+        ptp = task_pt_regs(tsk);
        tos = (tsk->thread.fsr >> 11) & 7;
         for (i = 0; i < 8; i++)
                put_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
@@ -1733,7 +1734,7 @@ restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __u
         *  Stack frames start with 16-bytes of temp space
         */
        swp = (struct switch_stack *)(tsk->thread.ksp + 16);
-       ptp = ia64_task_regs(tsk);
+       ptp = task_pt_regs(tsk);
        tos = (tsk->thread.fsr >> 11) & 7;
        for (i = 0; i < 8; i++)
        get_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
index 4de7f6759093720595fe958f0b757d5adb884cd5..346fedf9ea479a361ea7cdca2173b442b2302adb 100644 (file)
@@ -638,6 +638,13 @@ static int __kprobes pre_kprobes_handler(struct die_args *args)
                        if (p->break_handler && p->break_handler(p, regs)) {
                                goto ss_probe;
                        }
+               } else if (!is_ia64_break_inst(regs)) {
+                       /* The breakpoint instruction was removed by
+                        * another cpu right after we hit, no further
+                        * handling of this interrupt is appropriate
+                        */
+                       ret = 1;
+                       goto no_kprobe;
                } else {
                        /* Not our break */
                        goto no_kprobe;
index 355af15287c7eb318f08382cf6d695a6bb677524..ee7eec9ee57648cee03a84aeacea97651577131d 100644 (file)
@@ -766,7 +766,7 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
                        l = strlen(previous_current->comm);
                snprintf(comm, sizeof(comm), "%s %*s %d",
                        current->comm, l, previous_current->comm,
-                       previous_current->thread_info->cpu);
+                       task_thread_info(previous_current)->cpu);
        }
        memcpy(current->comm, comm, sizeof(current->comm));
 
@@ -1423,7 +1423,7 @@ format_mca_init_stack(void *mca_data, unsigned long offset,
        struct task_struct *p = (struct task_struct *)((char *)mca_data + offset);
        struct thread_info *ti;
        memset(p, 0, KERNEL_STACK_SIZE);
-       ti = (struct thread_info *)((char *)p + IA64_TASK_SIZE);
+       ti = task_thread_info(p);
        ti->flags = _TIF_MCA_INIT;
        ti->preempt_count = 1;
        ti->task = p;
index 410d4804fa6e0cb4086e6fb6af75760337a60d23..bd87cb6b7a8135b1dbfc7e927b8d464c66379db4 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/pagemap.h>
 #include <linux/mount.h>
 #include <linux/bitops.h>
+#include <linux/capability.h>
 #include <linux/rcupdate.h>
 
 #include <asm/errno.h>
@@ -1709,7 +1710,7 @@ static void
 pfm_syswide_force_stop(void *info)
 {
        pfm_context_t   *ctx = (pfm_context_t *)info;
-       struct pt_regs *regs = ia64_task_regs(current);
+       struct pt_regs *regs = task_pt_regs(current);
        struct task_struct *owner;
        unsigned long flags;
        int ret;
@@ -1814,7 +1815,7 @@ pfm_flush(struct file *filp)
        is_system = ctx->ctx_fl_system;
 
        task = PFM_CTX_TASK(ctx);
-       regs = ia64_task_regs(task);
+       regs = task_pt_regs(task);
 
        DPRINT(("ctx_state=%d is_current=%d\n",
                state,
@@ -1944,7 +1945,7 @@ pfm_close(struct inode *inode, struct file *filp)
        is_system = ctx->ctx_fl_system;
 
        task = PFM_CTX_TASK(ctx);
-       regs = ia64_task_regs(task);
+       regs = task_pt_regs(task);
 
        DPRINT(("ctx_state=%d is_current=%d\n", 
                state,
@@ -4051,7 +4052,7 @@ pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
                 */
                ia64_psr(regs)->up = 0;
        } else {
-               tregs = ia64_task_regs(task);
+               tregs = task_pt_regs(task);
 
                /*
                 * stop monitoring at the user level
@@ -4133,7 +4134,7 @@ pfm_start(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
                ia64_psr(regs)->up = 1;
 
        } else {
-               tregs = ia64_task_regs(ctx->ctx_task);
+               tregs = task_pt_regs(ctx->ctx_task);
 
                /*
                 * start monitoring at the kernel level the next
@@ -4403,7 +4404,7 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
                /*
                 * when not current, task MUST be stopped, so this is safe
                 */
-               regs = ia64_task_regs(task);
+               regs = task_pt_regs(task);
 
                /* force a full reload */
                ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
@@ -4529,7 +4530,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
        /*
         * per-task mode
         */
-       tregs = task == current ? regs : ia64_task_regs(task);
+       tregs = task == current ? regs : task_pt_regs(task);
 
        if (task == current) {
                /*
@@ -4592,7 +4593,7 @@ pfm_exit_thread(struct task_struct *task)
 {
        pfm_context_t *ctx;
        unsigned long flags;
-       struct pt_regs *regs = ia64_task_regs(task);
+       struct pt_regs *regs = task_pt_regs(task);
        int ret, state;
        int free_ok = 0;
 
@@ -4925,7 +4926,7 @@ restart_args:
        if (unlikely(ret)) goto abort_locked;
 
 skip_fd:
-       ret = (*func)(ctx, args_k, count, ia64_task_regs(current));
+       ret = (*func)(ctx, args_k, count, task_pt_regs(current));
 
        call_made = 1;
 
@@ -5049,7 +5050,7 @@ pfm_handle_work(void)
 
        pfm_clear_task_notify();
 
-       regs = ia64_task_regs(current);
+       regs = task_pt_regs(current);
 
        /*
         * extract reason for being here and clear
@@ -5793,7 +5794,7 @@ pfm_syst_wide_update_task(struct task_struct *task, unsigned long info, int is_c
         * on every CPU, so we can rely on the pid to identify the idle task.
         */
        if ((info & PFM_CPUINFO_EXCL_IDLE) == 0 || task->pid) {
-               regs = ia64_task_regs(task);
+               regs = task_pt_regs(task);
                ia64_psr(regs)->pp = is_ctxswin ? dcr_pp : 0;
                return;
        }
@@ -5876,7 +5877,7 @@ pfm_save_regs(struct task_struct *task)
        flags = pfm_protect_ctx_ctxsw(ctx);
 
        if (ctx->ctx_state == PFM_CTX_ZOMBIE) {
-               struct pt_regs *regs = ia64_task_regs(task);
+               struct pt_regs *regs = task_pt_regs(task);
 
                pfm_clear_psr_up();
 
@@ -6076,7 +6077,7 @@ pfm_load_regs (struct task_struct *task)
        BUG_ON(psr & IA64_PSR_I);
 
        if (unlikely(ctx->ctx_state == PFM_CTX_ZOMBIE)) {
-               struct pt_regs *regs = ia64_task_regs(task);
+               struct pt_regs *regs = task_pt_regs(task);
 
                BUG_ON(ctx->ctx_smpl_hdr);
 
@@ -6445,7 +6446,7 @@ pfm_alt_save_pmu_state(void *data)
 {
        struct pt_regs *regs;
 
-       regs = ia64_task_regs(current);
+       regs = task_pt_regs(current);
 
        DPRINT(("called\n"));
 
@@ -6471,7 +6472,7 @@ pfm_alt_restore_pmu_state(void *data)
 {
        struct pt_regs *regs;
 
-       regs = ia64_task_regs(current);
+       regs = task_pt_regs(current);
 
        DPRINT(("called\n"));
 
@@ -6753,7 +6754,7 @@ dump_pmu_state(const char *from)
        local_irq_save(flags);
 
        this_cpu = smp_processor_id();
-       regs     = ia64_task_regs(current);
+       regs     = task_pt_regs(current);
        info     = PFM_CPUINFO_GET();
        dcr      = ia64_getreg(_IA64_REG_CR_DCR);
 
index e9904c74d2ba617679131802ce1f68858e3b2826..309d59658e5ff9344bbd122c8d364fed8b8a1c09 100644 (file)
@@ -328,7 +328,7 @@ ia64_save_extra (struct task_struct *task)
 #endif
 
 #ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(ia64_task_regs(task)))
+       if (IS_IA32_PROCESS(task_pt_regs(task)))
                ia32_save_state(task);
 #endif
 }
@@ -353,7 +353,7 @@ ia64_load_extra (struct task_struct *task)
 #endif
 
 #ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(ia64_task_regs(task)))
+       if (IS_IA32_PROCESS(task_pt_regs(task)))
                ia32_load_state(task);
 #endif
 }
@@ -488,7 +488,7 @@ copy_thread (int nr, unsigned long clone_flags,
         * If we're cloning an IA32 task then save the IA32 extra
         * state from the current task to the new task
         */
-       if (IS_IA32_PROCESS(ia64_task_regs(current))) {
+       if (IS_IA32_PROCESS(task_pt_regs(current))) {
                ia32_save_state(p);
                if (clone_flags & CLONE_SETTLS)
                        retval = ia32_clone_tls(p, child_ptregs);
@@ -701,7 +701,7 @@ int
 kernel_thread_helper (int (*fn)(void *), void *arg)
 {
 #ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(ia64_task_regs(current))) {
+       if (IS_IA32_PROCESS(task_pt_regs(current))) {
                /* A kernel thread is always a 64-bit process. */
                current->thread.map_base  = DEFAULT_MAP_BASE;
                current->thread.task_size = DEFAULT_TASK_SIZE;
@@ -722,7 +722,7 @@ flush_thread (void)
        current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID);
        ia64_drop_fpu(current);
 #ifdef CONFIG_IA32_SUPPORT
-       if (IS_IA32_PROCESS(ia64_task_regs(current))) {
+       if (IS_IA32_PROCESS(task_pt_regs(current))) {
                ia32_drop_partial_page_list(current);
                current->thread.task_size = IA32_PAGE_OFFSET;
                set_fs(USER_DS);
@@ -755,7 +755,7 @@ exit_thread (void)
        if (current->thread.flags & IA64_THREAD_DBG_VALID)
                pfm_release_debug_registers(current);
 #endif
-       if (IS_IA32_PROCESS(ia64_task_regs(current)))
+       if (IS_IA32_PROCESS(task_pt_regs(current)))
                ia32_drop_partial_page_list(current);
 }
 
index 8d88eeea02d12fa762a1d54ba71ce15be73529c9..eaed14aac6aa59592e201b91eff05e0ccb6a8ba6 100644 (file)
@@ -254,7 +254,7 @@ get_rnat (struct task_struct *task, struct switch_stack *sw,
        long num_regs, nbits;
        struct pt_regs *pt;
 
-       pt = ia64_task_regs(task);
+       pt = task_pt_regs(task);
        kbsp = (unsigned long *) sw->ar_bspstore;
        ubspstore = (unsigned long *) pt->ar_bspstore;
 
@@ -314,7 +314,7 @@ put_rnat (struct task_struct *task, struct switch_stack *sw,
        struct pt_regs *pt;
        unsigned long cfm, *urbs_kargs;
 
-       pt = ia64_task_regs(task);
+       pt = task_pt_regs(task);
        kbsp = (unsigned long *) sw->ar_bspstore;
        ubspstore = (unsigned long *) pt->ar_bspstore;
 
@@ -407,7 +407,7 @@ ia64_peek (struct task_struct *child, struct switch_stack *child_stack,
 
        urbs_end = (long *) user_rbs_end;
        laddr = (unsigned long *) addr;
-       child_regs = ia64_task_regs(child);
+       child_regs = task_pt_regs(child);
        bspstore = (unsigned long *) child_regs->ar_bspstore;
        krbs = (unsigned long *) child + IA64_RBS_OFFSET/8;
        if (on_kernel_rbs(addr, (unsigned long) bspstore,
@@ -467,7 +467,7 @@ ia64_poke (struct task_struct *child, struct switch_stack *child_stack,
        struct pt_regs *child_regs;
 
        laddr = (unsigned long *) addr;
-       child_regs = ia64_task_regs(child);
+       child_regs = task_pt_regs(child);
        bspstore = (unsigned long *) child_regs->ar_bspstore;
        krbs = (unsigned long *) child + IA64_RBS_OFFSET/8;
        if (on_kernel_rbs(addr, (unsigned long) bspstore,
@@ -567,7 +567,7 @@ thread_matches (struct task_struct *thread, unsigned long addr)
                 */
                return 0;
 
-       thread_regs = ia64_task_regs(thread);
+       thread_regs = task_pt_regs(thread);
        thread_rbs_end = ia64_get_user_rbs_end(thread, thread_regs, NULL);
        if (!on_kernel_rbs(addr, thread_regs->ar_bspstore, thread_rbs_end))
                return 0;
@@ -627,7 +627,7 @@ find_thread_for_addr (struct task_struct *child, unsigned long addr)
 inline void
 ia64_flush_fph (struct task_struct *task)
 {
-       struct ia64_psr *psr = ia64_psr(ia64_task_regs(task));
+       struct ia64_psr *psr = ia64_psr(task_pt_regs(task));
 
        /*
         * Prevent migrating this task while
@@ -653,7 +653,7 @@ ia64_flush_fph (struct task_struct *task)
 void
 ia64_sync_fph (struct task_struct *task)
 {
-       struct ia64_psr *psr = ia64_psr(ia64_task_regs(task));
+       struct ia64_psr *psr = ia64_psr(task_pt_regs(task));
 
        ia64_flush_fph(task);
        if (!(task->thread.flags & IA64_THREAD_FPH_VALID)) {
@@ -794,7 +794,7 @@ access_uarea (struct task_struct *child, unsigned long addr,
                                          + offsetof(struct pt_regs, reg)))
 
 
-       pt = ia64_task_regs(child);
+       pt = task_pt_regs(child);
        sw = (struct switch_stack *) (child->thread.ksp + 16);
 
        if ((addr & 0x7) != 0) {
@@ -1120,7 +1120,7 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
        if (!access_ok(VERIFY_WRITE, ppr, sizeof(struct pt_all_user_regs)))
                return -EIO;
 
-       pt = ia64_task_regs(child);
+       pt = task_pt_regs(child);
        sw = (struct switch_stack *) (child->thread.ksp + 16);
        unw_init_from_blocked_task(&info, child);
        if (unw_unwind_to_user(&info) < 0) {
@@ -1265,7 +1265,7 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
        if (!access_ok(VERIFY_READ, ppr, sizeof(struct pt_all_user_regs)))
                return -EIO;
 
-       pt = ia64_task_regs(child);
+       pt = task_pt_regs(child);
        sw = (struct switch_stack *) (child->thread.ksp + 16);
        unw_init_from_blocked_task(&info, child);
        if (unw_unwind_to_user(&info) < 0) {
@@ -1403,7 +1403,7 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
 void
 ptrace_disable (struct task_struct *child)
 {
-       struct ia64_psr *child_psr = ia64_psr(ia64_task_regs(child));
+       struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child));
 
        /* make sure the single step/taken-branch trap bits are not set: */
        child_psr->ss = 0;
@@ -1456,7 +1456,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
        if (ret < 0)
                goto out_tsk;
 
-       pt = ia64_task_regs(child);
+       pt = task_pt_regs(child);
        sw = (struct switch_stack *) (child->thread.ksp + 16);
 
        switch (request) {
index 1461dc660b43af305b6b0687518f0e771b7d8dfe..a87a162a30865198b179142a90bd1ac548642814 100644 (file)
@@ -29,6 +29,7 @@
  *   Replace some NR_CPUS by cpus_online, for hotplug cpu.
  */
 
+#include <linux/capability.h>
 #include <linux/types.h>
 #include <linux/proc_fs.h>
 #include <linux/module.h>
index c33305d8e5eb21593e94396303ea9f0d971a409b..c0766575a3a2113a56792623dc16a64752263239 100644 (file)
@@ -60,6 +60,7 @@
 #include <asm/smp.h>
 #include <asm/system.h>
 #include <asm/unistd.h>
+#include <asm/system.h>
 
 #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
 # error "struct cpuinfo_ia64 too big!"
@@ -695,6 +696,7 @@ static void
 get_max_cacheline_size (void)
 {
        unsigned long line_size, max = 1;
+       unsigned int cache_size = 0;
        u64 l, levels, unique_caches;
         pal_cache_config_info_t cci;
         s64 status;
@@ -724,6 +726,8 @@ get_max_cacheline_size (void)
                line_size = 1 << cci.pcci_line_size;
                if (line_size > max)
                        max = line_size;
+               if (cache_size < cci.pcci_cache_size)
+                       cache_size = cci.pcci_cache_size;
                if (!cci.pcci_unified) {
                        status = ia64_pal_cache_config_info(l,
                                                    /* cache_type (instruction)= */ 1,
@@ -740,6 +744,9 @@ get_max_cacheline_size (void)
                        ia64_i_cache_stride_shift = cci.pcci_stride;
        }
   out:
+#ifdef CONFIG_SMP
+       max_cache_size = max(max_cache_size, cache_size);
+#endif
        if (max > ia64_max_cacheline_size)
                ia64_max_cacheline_size = max;
 }
@@ -794,7 +801,7 @@ cpu_init (void)
 #endif
 
        /* Clear the stack memory reserved for pt_regs: */
-       memset(ia64_task_regs(current), 0, sizeof(struct pt_regs));
+       memset(task_pt_regs(current), 0, sizeof(struct pt_regs));
 
        ia64_set_kr(IA64_KR_FPU_OWNER, 0);
 
@@ -870,6 +877,15 @@ cpu_init (void)
        pm_idle = default_idle;
 }
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ */
+void sched_cacheflush(void)
+{
+       ia64_sal_cache_flush(3);
+}
+
 void
 check_bugs (void)
 {
index 58ce07efc56e060bda10d23498592f960e2858bf..463f6bb44d07880993b0f13e282352100dd05cff 100644 (file)
@@ -655,11 +655,11 @@ set_sigdelayed(pid_t pid, int signo, int code, void __user *addr)
 
                if (!t)
                        return;
-               t->thread_info->sigdelayed.signo = signo;
-               t->thread_info->sigdelayed.code = code;
-               t->thread_info->sigdelayed.addr = addr;
-               t->thread_info->sigdelayed.start_time = start_time;
-               t->thread_info->sigdelayed.pid = pid;
+               task_thread_info(t)->sigdelayed.signo = signo;
+               task_thread_info(t)->sigdelayed.code = code;
+               task_thread_info(t)->sigdelayed.addr = addr;
+               task_thread_info(t)->sigdelayed.start_time = start_time;
+               task_thread_info(t)->sigdelayed.pid = pid;
                wmb();
                set_tsk_thread_flag(t, TIF_SIGDELAYED);
        }
index f2dbcd1db0d4dc99b3baca0d0b677c3ed788a58c..c7b943f1019981d4c5c16b2a93d7e623b516f263 100644 (file)
@@ -151,7 +151,7 @@ out:
 asmlinkage long
 sys_pipe (void)
 {
-       struct pt_regs *regs = ia64_task_regs(current);
+       struct pt_regs *regs = task_pt_regs(current);
        int fd[2];
        int retval;
 
index 768c21deb2e55f38337c8b1439e0e5a0b27613d7..493fb3f38dc37af5a7bc919cea2a98a9e06ed326 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/proc_fs.h>
+#include <linux/capability.h>
 #include <linux/device.h>
 #include <linux/delay.h>
 #include <asm/system.h>
index 2a1f250349b7027f057a2386c5ed555f0fafa171..5dfc7ea45cf7a9b19887f7de1049a7d337e5833e 100644 (file)
@@ -242,13 +242,10 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
 int copy_thread(int nr, unsigned long clone_flags, unsigned long spu,
        unsigned long unused, struct task_struct *tsk, struct pt_regs *regs)
 {
-       struct pt_regs *childregs;
-       unsigned long sp = (unsigned long)tsk->thread_info + THREAD_SIZE;
+       struct pt_regs *childregs = task_pt_regs(tsk);
        extern void ret_from_fork(void);
 
        /* Copy registers */
-       sp -= sizeof (struct pt_regs);
-       childregs = (struct pt_regs *)sp;
        *childregs = *regs;
 
        childregs->spu = spu;
index 9b75caaf5cec49ba98a0357312f4a4cdbb35042f..340a3bf59b88d6935fc004ea95669ee1f59cdc61 100644 (file)
 #include <asm/processor.h>
 #include <asm/mmu_context.h>
 
-/*
- * Get the address of the live pt_regs for the specified task.
- * These are saved onto the top kernel stack when the process
- * is not running.
- *
- * Note: if a user thread is execve'd from kernel space, the
- * kernel stack will not be empty on entry to the kernel, so
- * ptracing these tasks will fail.
- */
-static inline struct pt_regs *
-get_user_regs(struct task_struct *task)
-{
-        return (struct pt_regs *)
-                ((unsigned long)task->thread_info + THREAD_SIZE
-                 - sizeof(struct pt_regs));
-}
-
 /*
  * This routine will get a word off of the process kernel stack.
  */
@@ -59,7 +42,7 @@ get_stack_long(struct task_struct *task, int offset)
 {
        unsigned long *stack;
 
-       stack = (unsigned long *)get_user_regs(task);
+       stack = (unsigned long *)task_pt_regs(task);
 
        return stack[offset];
 }
@@ -72,7 +55,7 @@ put_stack_long(struct task_struct *task, int offset, unsigned long data)
 {
        unsigned long *stack;
 
-       stack = (unsigned long *)get_user_regs(task);
+       stack = (unsigned long *)task_pt_regs(task);
        stack[offset] = data;
 
        return 0;
@@ -208,7 +191,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
  */
 static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
 {
-       struct pt_regs *regs = get_user_regs(tsk);
+       struct pt_regs *regs = task_pt_regs(tsk);
 
        return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
 }
@@ -223,7 +206,7 @@ static int ptrace_setregs(struct task_struct *tsk, void __user *uregs)
 
        ret = -EFAULT;
        if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
-               struct pt_regs *regs = get_user_regs(tsk);
+               struct pt_regs *regs = task_pt_regs(tsk);
                *regs = newregs;
                ret = 0;
        }
index b90c54169fa5ae22bd82f68988d44c2a14705873..d7ec16e7fb259f50d6ee32ef99a332259d3891cc 100644 (file)
@@ -286,7 +286,7 @@ static void __init do_boot_cpu(int phys_id)
        /* So we see what's up   */
        printk("Booting processor %d/%d\n", phys_id, cpu_id);
        stack_start.spi = (void *)idle->thread.sp;
-       idle->thread_info->cpu = cpu_id;
+       task_thread_info(idle)->cpu = cpu_id;
 
        /*
         * Send Startup IPI
index d9edf2d1a4928d47cc5eaf01e580ebba7a9eb3bc..b0aa61bf8700df5d532e0d64d20ff37f02834f75 100644 (file)
@@ -126,9 +126,9 @@ void __init amiga_init_IRQ(void)
                gayle.inten = GAYLE_IRQ_IDE;
 
        /* turn off all interrupts and enable the master interrupt bit */
-       custom.intena = 0x7fff;
-       custom.intreq = 0x7fff;
-       custom.intena = IF_SETCLR | IF_INTEN;
+       amiga_custom.intena = 0x7fff;
+       amiga_custom.intreq = 0x7fff;
+       amiga_custom.intena = IF_SETCLR | IF_INTEN;
 
        cia_init_IRQ(&ciaa_base);
        cia_init_IRQ(&ciab_base);
@@ -245,7 +245,7 @@ int amiga_request_irq(unsigned int irq,
 
        /* enable the interrupt */
        if (irq < IRQ_AMIGA_PORTS && !ami_ablecount[irq])
-               custom.intena = IF_SETCLR | amiga_intena_vals[irq];
+               amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq];
 
        return error;
 }
@@ -274,7 +274,7 @@ void amiga_free_irq(unsigned int irq, void *dev_id)
                amiga_delete_irq(&ami_irq_list[irq], dev_id);
                /* if server list empty, disable the interrupt */
                if (!ami_irq_list[irq] && irq < IRQ_AMIGA_PORTS)
-                       custom.intena = amiga_intena_vals[irq];
+                       amiga_custom.intena = amiga_intena_vals[irq];
        } else {
                if (ami_irq_list[irq]->dev_id != dev_id)
                        printk("%s: removing probably wrong IRQ %d from %s\n",
@@ -283,7 +283,7 @@ void amiga_free_irq(unsigned int irq, void *dev_id)
                ami_irq_list[irq]->flags   = 0;
                ami_irq_list[irq]->dev_id  = NULL;
                ami_irq_list[irq]->devname = NULL;
-               custom.intena = amiga_intena_vals[irq];
+               amiga_custom.intena = amiga_intena_vals[irq];
        }
 }
 
@@ -327,7 +327,7 @@ void amiga_enable_irq(unsigned int irq)
        }
 
        /* enable the interrupt */
-       custom.intena = IF_SETCLR | amiga_intena_vals[irq];
+       amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq];
 }
 
 void amiga_disable_irq(unsigned int irq)
@@ -358,7 +358,7 @@ void amiga_disable_irq(unsigned int irq)
        }
 
        /* disable the interrupt */
-       custom.intena = amiga_intena_vals[irq];
+       amiga_custom.intena = amiga_intena_vals[irq];
 }
 
 inline void amiga_do_irq(int irq, struct pt_regs *fp)
@@ -373,7 +373,7 @@ void amiga_do_irq_list(int irq, struct pt_regs *fp)
 
        kstat_cpu(0).irqs[SYS_IRQS + irq]++;
 
-       custom.intreq = amiga_intena_vals[irq];
+       amiga_custom.intreq = amiga_intena_vals[irq];
 
        for (node = ami_irq_list[irq]; node; node = node->next)
                node->handler(irq, node->dev_id, fp);
@@ -385,23 +385,23 @@ void amiga_do_irq_list(int irq, struct pt_regs *fp)
 
 static irqreturn_t ami_int1(int irq, void *dev_id, struct pt_regs *fp)
 {
-       unsigned short ints = custom.intreqr & custom.intenar;
+       unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
 
        /* if serial transmit buffer empty, interrupt */
        if (ints & IF_TBE) {
-               custom.intreq = IF_TBE;
+               amiga_custom.intreq = IF_TBE;
                amiga_do_irq(IRQ_AMIGA_TBE, fp);
        }
 
        /* if floppy disk transfer complete, interrupt */
        if (ints & IF_DSKBLK) {
-               custom.intreq = IF_DSKBLK;
+               amiga_custom.intreq = IF_DSKBLK;
                amiga_do_irq(IRQ_AMIGA_DSKBLK, fp);
        }
 
        /* if software interrupt set, interrupt */
        if (ints & IF_SOFT) {
-               custom.intreq = IF_SOFT;
+               amiga_custom.intreq = IF_SOFT;
                amiga_do_irq(IRQ_AMIGA_SOFT, fp);
        }
        return IRQ_HANDLED;
@@ -409,17 +409,17 @@ static irqreturn_t ami_int1(int irq, void *dev_id, struct pt_regs *fp)
 
 static irqreturn_t ami_int3(int irq, void *dev_id, struct pt_regs *fp)
 {
-       unsigned short ints = custom.intreqr & custom.intenar;
+       unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
 
        /* if a blitter interrupt */
        if (ints & IF_BLIT) {
-               custom.intreq = IF_BLIT;
+               amiga_custom.intreq = IF_BLIT;
                amiga_do_irq(IRQ_AMIGA_BLIT, fp);
        }
 
        /* if a copper interrupt */
        if (ints & IF_COPER) {
-               custom.intreq = IF_COPER;
+               amiga_custom.intreq = IF_COPER;
                amiga_do_irq(IRQ_AMIGA_COPPER, fp);
        }
 
@@ -431,29 +431,29 @@ static irqreturn_t ami_int3(int irq, void *dev_id, struct pt_regs *fp)
 
 static irqreturn_t ami_int4(int irq, void *dev_id, struct pt_regs *fp)
 {
-       unsigned short ints = custom.intreqr & custom.intenar;
+       unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
 
        /* if audio 0 interrupt */
        if (ints & IF_AUD0) {
-               custom.intreq = IF_AUD0;
+               amiga_custom.intreq = IF_AUD0;
                amiga_do_irq(IRQ_AMIGA_AUD0, fp);
        }
 
        /* if audio 1 interrupt */
        if (ints & IF_AUD1) {
-               custom.intreq = IF_AUD1;
+               amiga_custom.intreq = IF_AUD1;
                amiga_do_irq(IRQ_AMIGA_AUD1, fp);
        }
 
        /* if audio 2 interrupt */
        if (ints & IF_AUD2) {
-               custom.intreq = IF_AUD2;
+               amiga_custom.intreq = IF_AUD2;
                amiga_do_irq(IRQ_AMIGA_AUD2, fp);
        }
 
        /* if audio 3 interrupt */
        if (ints & IF_AUD3) {
-               custom.intreq = IF_AUD3;
+               amiga_custom.intreq = IF_AUD3;
                amiga_do_irq(IRQ_AMIGA_AUD3, fp);
        }
        return IRQ_HANDLED;
@@ -461,7 +461,7 @@ static irqreturn_t ami_int4(int irq, void *dev_id, struct pt_regs *fp)
 
 static irqreturn_t ami_int5(int irq, void *dev_id, struct pt_regs *fp)
 {
-       unsigned short ints = custom.intreqr & custom.intenar;
+       unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
 
        /* if serial receive buffer full interrupt */
        if (ints & IF_RBF) {
@@ -471,7 +471,7 @@ static irqreturn_t ami_int5(int irq, void *dev_id, struct pt_regs *fp)
 
        /* if a disk sync interrupt */
        if (ints & IF_DSKSYN) {
-               custom.intreq = IF_DSKSYN;
+               amiga_custom.intreq = IF_DSKSYN;
                amiga_do_irq(IRQ_AMIGA_DSKSYN, fp);
        }
        return IRQ_HANDLED;
index bd5d134e9f123856fc052ad5139a7a137b848d6a..ae94db5d93b2208942218a89dba61d354fb7e2ae 100644 (file)
@@ -24,6 +24,8 @@ static const signed char sine_data[] = {
 };
 #define DATA_SIZE      (sizeof(sine_data)/sizeof(sine_data[0]))
 
+#define custom amiga_custom
+
     /*
      * The minimum period for audio may be modified by the frame buffer
      * device since it depends on htotal (for OCS/ECS/AGA)
index 7d55682615e3604ffeef19fab1708d4a9bf57ef0..9476eb9440f57436365b8de4f6d70e02bb9500c0 100644 (file)
@@ -60,7 +60,7 @@ unsigned char cia_set_irq(struct ciabase *base, unsigned char mask)
        else
                base->icr_data &= ~mask;
        if (base->icr_data & base->icr_mask)
-               custom.intreq = IF_SETCLR | base->int_mask;
+               amiga_custom.intreq = IF_SETCLR | base->int_mask;
        return old & base->icr_mask;
 }
 
@@ -89,7 +89,7 @@ unsigned char cia_able_irq(struct ciabase *base, unsigned char mask)
                }
        }
        if (base->icr_data & base->icr_mask)
-               custom.intreq = IF_SETCLR | base->int_mask;
+               amiga_custom.intreq = IF_SETCLR | base->int_mask;
        return old;
 }
 
@@ -133,7 +133,7 @@ static irqreturn_t cia_handler(int irq, void *dev_id, struct pt_regs *fp)
        mach_irq = base->cia_irq;
        irq = SYS_IRQS + mach_irq;
        ints = cia_set_irq(base, CIA_ICR_ALL);
-       custom.intreq = base->int_mask;
+       amiga_custom.intreq = base->int_mask;
        for (i = 0; i < CIA_IRQS; i++, irq++, mach_irq++) {
                if (ints & 1) {
                        kstat_cpu(0).irqs[irq]++;
@@ -162,7 +162,7 @@ void __init cia_init_IRQ(struct ciabase *base)
        /* install CIA handler */
        request_irq(base->handler_irq, cia_handler, 0, base->name, base);
 
-       custom.intena = IF_SETCLR | base->int_mask;
+       amiga_custom.intena = IF_SETCLR | base->int_mask;
 }
 
 int cia_get_irq_list(struct ciabase *base, struct seq_file *p)
index 4775e18a78f08a7f262730de6adc05969bb184b8..12e3706fe02cf17839d0910dc9d31f5b960b4c1a 100644 (file)
@@ -105,9 +105,6 @@ static int a2000_hwclk (int, struct rtc_time *);
 static int amiga_set_clock_mmss (unsigned long);
 static unsigned int amiga_get_ss (void);
 extern void amiga_mksound( unsigned int count, unsigned int ticks );
-#ifdef CONFIG_AMIGA_FLOPPY
-extern void amiga_floppy_setup(char *, int *);
-#endif
 static void amiga_reset (void);
 extern void amiga_init_sound(void);
 static void amiga_savekmsg_init(void);
@@ -290,7 +287,7 @@ static void __init amiga_identify(void)
     case CS_OCS:
     case CS_ECS:
     case CS_AGA:
-      switch (custom.deniseid & 0xf) {
+      switch (amiga_custom.deniseid & 0xf) {
       case 0x0c:
        AMIGAHW_SET(DENISE_HR);
        break;
@@ -303,7 +300,7 @@ static void __init amiga_identify(void)
       AMIGAHW_SET(DENISE);
       break;
     }
-    switch ((custom.vposr>>8) & 0x7f) {
+    switch ((amiga_custom.vposr>>8) & 0x7f) {
     case 0x00:
       AMIGAHW_SET(AGNUS_PAL);
       break;
@@ -427,13 +424,7 @@ void __init config_amiga(void)
 
   mach_set_clock_mmss  = amiga_set_clock_mmss;
   mach_get_ss          = amiga_get_ss;
-#ifdef CONFIG_AMIGA_FLOPPY
-  mach_floppy_setup    = amiga_floppy_setup;
-#endif
   mach_reset           = amiga_reset;
-#ifdef CONFIG_DUMMY_CONSOLE
-  conswitchp           = &dummy_con;
-#endif
 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
   mach_beep            = amiga_mksound;
 #endif
@@ -447,9 +438,9 @@ void __init config_amiga(void)
   amiga_colorclock = 5*amiga_eclock;   /* 3.5 MHz */
 
   /* clear all DMA bits */
-  custom.dmacon = DMAF_ALL;
+  amiga_custom.dmacon = DMAF_ALL;
   /* ensure that the DMA master bit is set */
-  custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
+  amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
 
   /* don't use Z2 RAM as system memory on Z3 capable machines */
   if (AMIGAHW_PRESENT(ZORRO3)) {
@@ -830,8 +821,8 @@ static void amiga_savekmsg_init(void)
 
 static void amiga_serial_putc(char c)
 {
-    custom.serdat = (unsigned char)c | 0x100;
-    while (!(custom.serdatr & 0x2000))
+    amiga_custom.serdat = (unsigned char)c | 0x100;
+    while (!(amiga_custom.serdatr & 0x2000))
        ;
 }
 
@@ -855,11 +846,11 @@ int amiga_serial_console_wait_key(struct console *co)
 {
     int ch;
 
-    while (!(custom.intreqr & IF_RBF))
+    while (!(amiga_custom.intreqr & IF_RBF))
        barrier();
-    ch = custom.serdatr & 0xff;
+    ch = amiga_custom.serdatr & 0xff;
     /* clear the interrupt, so that another character can be read */
-    custom.intreq = IF_RBF;
+    amiga_custom.intreq = IF_RBF;
     return ch;
 }
 
index 264929471253b371a86aa5eb36877b64159cb55c..d401962d9b251e53dcef279d5045473056d6f995 100644 (file)
@@ -176,9 +176,6 @@ void config_apollo(void) {
        mach_set_clock_mmss  = dn_dummy_set_clock_mmss; /* */
        mach_process_int     = dn_process_int;
        mach_reset           = dn_dummy_reset;  /* */
-#ifdef CONFIG_DUMMY_CONSOLE
-        conswitchp           = &dummy_con;
-#endif
 #ifdef CONFIG_HEARTBEAT
        mach_heartbeat = dn_heartbeat;
 #endif
index 9261d2deeaf5b7629f83f63a857f66fb55fe6d53..1012b08e552200a75dc17a39f64d201f686399fd 100644 (file)
@@ -52,9 +52,6 @@ int atari_rtc_year_offset;
 
 /* local function prototypes */
 static void atari_reset( void );
-#ifdef CONFIG_ATARI_FLOPPY
-extern void atari_floppy_setup(char *, int *);
-#endif
 static void atari_get_model(char *model);
 static int atari_get_hardware_list(char *buffer);
 
@@ -244,12 +241,6 @@ void __init config_atari(void)
     mach_get_irq_list   = show_atari_interrupts;
     mach_gettimeoffset   = atari_gettimeoffset;
     mach_reset           = atari_reset;
-#ifdef CONFIG_ATARI_FLOPPY
-    mach_floppy_setup   = atari_floppy_setup;
-#endif
-#ifdef CONFIG_DUMMY_CONSOLE
-    conswitchp          = &dummy_con;
-#endif
     mach_max_dma_address = 0xffffff;
 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
     mach_beep          = atari_mksound;
index eb63ca6ed94c591668bbc94c6861571e36da13f6..703cbc6dc9cc3c95a547c0ea11f2e0aa4370df99 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/miscdevice.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
+#include <linux/capability.h>
 #include <linux/fcntl.h>
 #include <linux/init.h>
 #include <linux/poll.h>
@@ -46,6 +47,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        unsigned char msr;
        unsigned long flags;
        struct rtc_time wtime;
+       void __user *argp = (void __user *)arg;
 
        switch (cmd) {
        case RTC_RD_TIME:       /* Read the time/date from RTC  */
@@ -68,7 +70,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                } while (wtime.tm_sec != BCD2BIN(rtc->bcd_sec));
                rtc->msr = msr;
                local_irq_restore(flags);
-               return copy_to_user((void *)arg, &wtime, sizeof wtime) ?
+               return copy_to_user(argp, &wtime, sizeof wtime) ?
                                                                -EFAULT : 0;
        }
        case RTC_SET_TIME:      /* Set the RTC */
@@ -80,8 +82,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                if (!capable(CAP_SYS_ADMIN))
                        return -EACCES;
 
-               if (copy_from_user(&rtc_tm, (struct rtc_time*)arg,
-                                  sizeof(struct rtc_time)))
+               if (copy_from_user(&rtc_tm, argp, sizeof(struct rtc_time)))
                        return -EFAULT;
 
                yrs = rtc_tm.tm_year;
index a0b854f3f94add74e7c73d5dd569d4b0c9c8bb77..6d129eef370f1df8d5dab71c8127384c93ad3b16 100644 (file)
@@ -260,9 +260,6 @@ void __init config_hp300(void)
        mach_reset           = hp300_reset;
 #ifdef CONFIG_HEARTBEAT
        mach_heartbeat       = hp300_pulse;
-#endif
-#ifdef CONFIG_DUMMY_CONSOLE
-       conswitchp           = &dummy_con;
 #endif
        mach_max_dma_address = 0xffffffff;
 
index c787c5ba951310fe13f53e2e99d949c79f868e37..246a8820c2236b814e636985078b93cf78dd6c3b 100644 (file)
@@ -92,7 +92,7 @@ int main(void)
        DEFINE(TRAP_TRACE, TRAP_TRACE);
 
        /* offsets into the custom struct */
-       DEFINE(CUSTOMBASE, &custom);
+       DEFINE(CUSTOMBASE, &amiga_custom);
        DEFINE(C_INTENAR, offsetof(struct CUSTOM, intenar));
        DEFINE(C_INTREQR, offsetof(struct CUSTOM, intreqr));
        DEFINE(C_INTENA, offsetof(struct CUSTOM, intena));
index d4336d846df146c8e3f6f771481c1e19c360a144..70002c146eed19c0c5dd76c73092d6a56f11df25 100644 (file)
  * Macintosh console support
  */
 
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE
 #define CONSOLE
 #define CONSOLE_PENGUIN
+#endif
 
 /*
  * Macintosh serial debug support; outputs boot info to the printer
index 13d109328a428166d4a11ba456595ff2d0170a91..3f9cb55d0356bbab9b4cf4301152f0e40550fc17 100644 (file)
@@ -238,10 +238,9 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 {
        struct pt_regs * childregs;
        struct switch_stack * childstack, *stack;
-       unsigned long stack_offset, *retp;
+       unsigned long *retp;
 
-       stack_offset = THREAD_SIZE - sizeof(struct pt_regs);
-       childregs = (struct pt_regs *) ((unsigned long) (p->thread_info) + stack_offset);
+       childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
 
        *childregs = *regs;
        childregs->d0 = 0;
@@ -386,7 +385,7 @@ unsigned long get_wchan(struct task_struct *p)
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;
 
-       stack_page = (unsigned long)(p->thread_info);
+       stack_page = (unsigned long)task_stack_page(p);
        fp = ((struct switch_stack *)p->thread.ksp)->a6;
        do {
                if (fp < stack_page+sizeof(struct thread_info) ||
index d6ca99242e5aa14a885182add91366b6d0e1448d..750d5b3c971fe001a2d86808a30b9cd237b0eebe 100644 (file)
@@ -84,9 +84,6 @@ void (*mach_reset)( void );
 void (*mach_halt)( void );
 void (*mach_power_off)( void );
 long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
-#if defined(CONFIG_AMIGA_FLOPPY) || defined(CONFIG_ATARI_FLOPPY)
-void (*mach_floppy_setup) (char *, int *) __initdata = NULL;
-#endif
 #ifdef CONFIG_HEARTBEAT
 void (*mach_heartbeat) (int);
 EXPORT_SYMBOL(mach_heartbeat);
@@ -100,6 +97,8 @@ void (*mach_beep)(unsigned int, unsigned int);
 #if defined(CONFIG_ISA) && defined(MULTI_ISA)
 int isa_type;
 int isa_sex;
+EXPORT_SYMBOL(isa_type);
+EXPORT_SYMBOL(isa_sex);
 #endif
 
 extern int amiga_parse_bootinfo(const struct bi_record *);
@@ -280,6 +279,10 @@ void __init setup_arch(char **cmdline_p)
            }
        }
 
+#ifdef CONFIG_DUMMY_CONSOLE
+       conswitchp = &dummy_con;
+#endif
+
        switch (m68k_machtype) {
 #ifdef CONFIG_AMIGA
            case MACH_AMIGA:
@@ -521,16 +524,6 @@ int get_hardware_list(char *buffer)
     return(len);
 }
 
-
-#if defined(CONFIG_AMIGA_FLOPPY) || defined(CONFIG_ATARI_FLOPPY)
-void __init floppy_setup(char *str, int *ints)
-{
-       if (mach_floppy_setup)
-               mach_floppy_setup (str, ints);
-}
-
-#endif
-
 void check_bugs(void)
 {
 #ifndef CONFIG_M68KFPU_EMU
index 9c636a4c238d5f0c3f01d46b6938d082517dafe1..866917bfa0280f16898df65c5d7cc632cc63b957 100644 (file)
@@ -96,7 +96,7 @@ asmlinkage int do_sigsuspend(struct pt_regs *regs)
 asmlinkage int
 do_rt_sigsuspend(struct pt_regs *regs)
 {
-       sigset_t *unewset = (sigset_t *)regs->d1;
+       sigset_t __user *unewset = (sigset_t __user *)regs->d1;
        size_t sigsetsize = (size_t)regs->d2;
        sigset_t saveset, newset;
 
@@ -122,8 +122,8 @@ do_rt_sigsuspend(struct pt_regs *regs)
 }
 
 asmlinkage int
-sys_sigaction(int sig, const struct old_sigaction *act,
-             struct old_sigaction *oact)
+sys_sigaction(int sig, const struct old_sigaction __user *act,
+             struct old_sigaction __user *oact)
 {
        struct k_sigaction new_ka, old_ka;
        int ret;
@@ -154,7 +154,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
 }
 
 asmlinkage int
-sys_sigaltstack(const stack_t *uss, stack_t *uoss)
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
 {
        return do_sigaltstack(uss, uoss, rdusp());
 }
@@ -169,10 +169,10 @@ sys_sigaltstack(const stack_t *uss, stack_t *uoss)
 
 struct sigframe
 {
-       char *pretcode;
+       char __user *pretcode;
        int sig;
        int code;
-       struct sigcontext *psc;
+       struct sigcontext __user *psc;
        char retcode[8];
        unsigned long extramask[_NSIG_WORDS-1];
        struct sigcontext sc;
@@ -180,10 +180,10 @@ struct sigframe
 
 struct rt_sigframe
 {
-       char *pretcode;
+       char __user *pretcode;
        int sig;
-       struct siginfo *pinfo;
-       void *puc;
+       struct siginfo __user *pinfo;
+       void __user *puc;
        char retcode[8];
        struct siginfo info;
        struct ucontext uc;
@@ -248,7 +248,7 @@ out:
 #define uc_formatvec   uc_filler[FPCONTEXT_SIZE/4]
 #define uc_extra       uc_filler[FPCONTEXT_SIZE/4+1]
 
-static inline int rt_restore_fpu_state(struct ucontext *uc)
+static inline int rt_restore_fpu_state(struct ucontext __user *uc)
 {
        unsigned char fpstate[FPCONTEXT_SIZE];
        int context_size = CPU_IS_060 ? 8 : 0;
@@ -267,7 +267,7 @@ static inline int rt_restore_fpu_state(struct ucontext *uc)
                return 0;
        }
 
-       if (__get_user(*(long *)fpstate, (long *)&uc->uc_fpstate))
+       if (__get_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate))
                goto out;
        if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
                if (!CPU_IS_060)
@@ -306,7 +306,7 @@ static inline int rt_restore_fpu_state(struct ucontext *uc)
                                    "m" (*fpregs.f_fpcntl));
        }
        if (context_size &&
-           __copy_from_user(fpstate + 4, (long *)&uc->uc_fpstate + 1,
+           __copy_from_user(fpstate + 4, (long __user *)&uc->uc_fpstate + 1,
                             context_size))
                goto out;
        __asm__ volatile (".chip 68k/68881\n\t"
@@ -319,7 +319,7 @@ out:
 }
 
 static inline int
-restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, void *fp,
+restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __user *fp,
                   int *pd0)
 {
        int fsize, formatvec;
@@ -404,10 +404,10 @@ badframe:
 
 static inline int
 rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
-                   struct ucontext *uc, int *pd0)
+                   struct ucontext __user *uc, int *pd0)
 {
        int fsize, temp;
-       greg_t *gregs = uc->uc_mcontext.gregs;
+       greg_t __user *gregs = uc->uc_mcontext.gregs;
        unsigned long usp;
        int err;
 
@@ -506,7 +506,7 @@ asmlinkage int do_sigreturn(unsigned long __unused)
        struct switch_stack *sw = (struct switch_stack *) &__unused;
        struct pt_regs *regs = (struct pt_regs *) (sw + 1);
        unsigned long usp = rdusp();
-       struct sigframe *frame = (struct sigframe *)(usp - 4);
+       struct sigframe __user *frame = (struct sigframe __user *)(usp - 4);
        sigset_t set;
        int d0;
 
@@ -536,7 +536,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused)
        struct switch_stack *sw = (struct switch_stack *) &__unused;
        struct pt_regs *regs = (struct pt_regs *) (sw + 1);
        unsigned long usp = rdusp();
-       struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4);
+       struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4);
        sigset_t set;
        int d0;
 
@@ -596,7 +596,7 @@ static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs)
        }
 }
 
-static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
+static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs)
 {
        unsigned char fpstate[FPCONTEXT_SIZE];
        int context_size = CPU_IS_060 ? 8 : 0;
@@ -617,7 +617,7 @@ static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
                          ".chip 68k"
                          : : "m" (*fpstate) : "memory");
 
-       err |= __put_user(*(long *)fpstate, (long *)&uc->uc_fpstate);
+       err |= __put_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate);
        if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
                fpregset_t fpregs;
                if (!CPU_IS_060)
@@ -642,7 +642,7 @@ static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
                                    sizeof(fpregs));
        }
        if (context_size)
-               err |= copy_to_user((long *)&uc->uc_fpstate + 1, fpstate + 4,
+               err |= copy_to_user((long __user *)&uc->uc_fpstate + 1, fpstate + 4,
                                    context_size);
        return err;
 }
@@ -662,10 +662,10 @@ static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
        save_fpu_state(sc, regs);
 }
 
-static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs)
+static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs)
 {
        struct switch_stack *sw = (struct switch_stack *)regs - 1;
-       greg_t *gregs = uc->uc_mcontext.gregs;
+       greg_t __user *gregs = uc->uc_mcontext.gregs;
        int err = 0;
 
        err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
@@ -753,7 +753,7 @@ static inline void push_cache (unsigned long vaddr)
        }
 }
 
-static inline void *
+static inline void __user *
 get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
 {
        unsigned long usp;
@@ -766,13 +766,13 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
                if (!on_sig_stack(usp))
                        usp = current->sas_ss_sp + current->sas_ss_size;
        }
-       return (void *)((usp - frame_size) & -8UL);
+       return (void __user *)((usp - frame_size) & -8UL);
 }
 
 static void setup_frame (int sig, struct k_sigaction *ka,
                         sigset_t *set, struct pt_regs *regs)
 {
-       struct sigframe *frame;
+       struct sigframe __user *frame;
        int fsize = frame_extra_sizes[regs->format];
        struct sigcontext context;
        int err = 0;
@@ -813,7 +813,7 @@ static void setup_frame (int sig, struct k_sigaction *ka,
        err |= __put_user(frame->retcode, &frame->pretcode);
        /* moveq #,d0; trap #0 */
        err |= __put_user(0x70004e40 + (__NR_sigreturn << 16),
-                         (long *)(frame->retcode));
+                         (long __user *)(frame->retcode));
 
        if (err)
                goto give_sigsegv;
@@ -849,7 +849,7 @@ give_sigsegv:
 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 rt_sigframe __user *frame;
        int fsize = frame_extra_sizes[regs->format];
        int err = 0;
 
@@ -880,8 +880,8 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
 
        /* Create the ucontext.  */
        err |= __put_user(0, &frame->uc.uc_flags);
-       err |= __put_user(0, &frame->uc.uc_link);
-       err |= __put_user((void *)current->sas_ss_sp,
+       err |= __put_user(NULL, &frame->uc.uc_link);
+       err |= __put_user((void __user *)current->sas_ss_sp,
                          &frame->uc.uc_stack.ss_sp);
        err |= __put_user(sas_ss_flags(rdusp()),
                          &frame->uc.uc_stack.ss_flags);
@@ -893,8 +893,8 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
        err |= __put_user(frame->retcode, &frame->pretcode);
        /* moveq #,d0; notb d0; trap #0 */
        err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
-                         (long *)(frame->retcode + 0));
-       err |= __put_user(0x4e40, (short *)(frame->retcode + 4));
+                         (long __user *)(frame->retcode + 0));
+       err |= __put_user(0x4e40, (short __user *)(frame->retcode + 4));
 
        if (err)
                goto give_sigsegv;
index 2ed7b783f6541f97929fcac6c92ca149c6445b13..143c552d38f36a6ca799bee01e8a2e418934cdb8 100644 (file)
@@ -6,6 +6,7 @@
  * platform.
  */
 
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
@@ -31,7 +32,7 @@
  * sys_pipe() is the normal C calling standard for creating
  * a pipe. It's not the way unix traditionally does this, though.
  */
-asmlinkage int sys_pipe(unsigned long * fildes)
+asmlinkage int sys_pipe(unsigned long __user * fildes)
 {
        int fd[2];
        int error;
@@ -93,7 +94,7 @@ struct mmap_arg_struct {
        unsigned long offset;
 };
 
-asmlinkage int old_mmap(struct mmap_arg_struct *arg)
+asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
 {
        struct mmap_arg_struct a;
        int error = -EFAULT;
@@ -159,11 +160,11 @@ out:
 
 struct sel_arg_struct {
        unsigned long n;
-       fd_set *inp, *outp, *exp;
-       struct timeval *tvp;
+       fd_set __user *inp, *outp, *exp;
+       struct timeval __user *tvp;
 };
 
-asmlinkage int old_select(struct sel_arg_struct *arg)
+asmlinkage int old_select(struct sel_arg_struct __user *arg)
 {
        struct sel_arg_struct a;
 
@@ -179,7 +180,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
  * This is really horribly ugly.
  */
 asmlinkage int sys_ipc (uint call, int first, int second,
-                       int third, void *ptr, long fifth)
+                       int third, void __user *ptr, long fifth)
 {
        int version, ret;
 
@@ -189,14 +190,14 @@ asmlinkage int sys_ipc (uint call, int first, int second,
        if (call <= SEMCTL)
                switch (call) {
                case SEMOP:
-                       return sys_semop (first, (struct sembuf *)ptr, second);
+                       return sys_semop (first, ptr, second);
                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);
                        }
@@ -206,31 +207,26 @@ asmlinkage int sys_ipc (uint call, int first, int second,
        if (call <= MSGCTL)
                switch (call) {
                case MSGSND:
-                       return sys_msgsnd (first, (struct msgbuf *) ptr,
-                                         second, third);
+                       return sys_msgsnd (first, ptr, second, third);
                case MSGRCV:
                        switch (version) {
                        case 0: {
                                struct ipc_kludge tmp;
                                if (!ptr)
                                        return -EINVAL;
-                               if (copy_from_user (&tmp,
-                                                   (struct ipc_kludge *)ptr,
-                                                   sizeof (tmp)))
+                               if (copy_from_user (&tmp, ptr, sizeof (tmp)))
                                        return -EFAULT;
                                return sys_msgrcv (first, tmp.msgp, second,
                                                   tmp.msgtyp, third);
                                }
                        default:
-                               return sys_msgrcv (first,
-                                                  (struct msgbuf *) ptr,
+                               return sys_msgrcv (first, ptr,
                                                   second, fifth, third);
                        }
                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, ptr);
                default:
                        return -ENOSYS;
                }
@@ -240,20 +236,18 @@ asmlinkage int sys_ipc (uint call, int first, int second,
                        switch (version) {
                        default: {
                                ulong raddr;
-                               ret = do_shmat (first, (char *) ptr,
-                                                second, &raddr);
+                               ret = do_shmat (first, ptr, second, &raddr);
                                if (ret)
                                        return ret;
-                               return put_user (raddr, (ulong *) third);
+                               return put_user (raddr, (ulong __user *) third);
                        }
                        }
                case SHMDT:
-                       return sys_shmdt ((char *)ptr);
+                       return sys_shmdt (ptr);
                case SHMGET:
                        return sys_shmget (first, second, third);
                case SHMCTL:
-                       return sys_shmctl (first, second,
-                                          (struct shmid_ds *) ptr);
+                       return sys_shmctl (first, second, ptr);
                default:
                        return -ENOSYS;
                }
index deb36e8b04a269e3a933c98ca09644359f673f31..cdf58fbb3e730f3d2613aaab606e3639cd8e51ad 100644 (file)
@@ -169,25 +169,25 @@ void __init trap_init (void)
 
        if (CPU_IS_060 && !FPU_IS_EMU) {
                /* set up IFPSP entry points */
-               asmlinkage void snan_vec(void) asm ("_060_fpsp_snan");
-               asmlinkage void operr_vec(void) asm ("_060_fpsp_operr");
-               asmlinkage void ovfl_vec(void) asm ("_060_fpsp_ovfl");
-               asmlinkage void unfl_vec(void) asm ("_060_fpsp_unfl");
-               asmlinkage void dz_vec(void) asm ("_060_fpsp_dz");
-               asmlinkage void inex_vec(void) asm ("_060_fpsp_inex");
-               asmlinkage void fline_vec(void) asm ("_060_fpsp_fline");
-               asmlinkage void unsupp_vec(void) asm ("_060_fpsp_unsupp");
-               asmlinkage void effadd_vec(void) asm ("_060_fpsp_effadd");
-
-               vectors[VEC_FPNAN] = snan_vec;
-               vectors[VEC_FPOE] = operr_vec;
-               vectors[VEC_FPOVER] = ovfl_vec;
-               vectors[VEC_FPUNDER] = unfl_vec;
-               vectors[VEC_FPDIVZ] = dz_vec;
-               vectors[VEC_FPIR] = inex_vec;
-               vectors[VEC_LINE11] = fline_vec;
-               vectors[VEC_FPUNSUP] = unsupp_vec;
-               vectors[VEC_UNIMPEA] = effadd_vec;
+               asmlinkage void snan_vec6(void) asm ("_060_fpsp_snan");
+               asmlinkage void operr_vec6(void) asm ("_060_fpsp_operr");
+               asmlinkage void ovfl_vec6(void) asm ("_060_fpsp_ovfl");
+               asmlinkage void unfl_vec6(void) asm ("_060_fpsp_unfl");
+               asmlinkage void dz_vec6(void) asm ("_060_fpsp_dz");
+               asmlinkage void inex_vec6(void) asm ("_060_fpsp_inex");
+               asmlinkage void fline_vec6(void) asm ("_060_fpsp_fline");
+               asmlinkage void unsupp_vec6(void) asm ("_060_fpsp_unsupp");
+               asmlinkage void effadd_vec6(void) asm ("_060_fpsp_effadd");
+
+               vectors[VEC_FPNAN] = snan_vec6;
+               vectors[VEC_FPOE] = operr_vec6;
+               vectors[VEC_FPOVER] = ovfl_vec6;
+               vectors[VEC_FPUNDER] = unfl_vec6;
+               vectors[VEC_FPDIVZ] = dz_vec6;
+               vectors[VEC_FPIR] = inex_vec6;
+               vectors[VEC_LINE11] = fline_vec6;
+               vectors[VEC_FPUNSUP] = unsupp_vec6;
+               vectors[VEC_UNIMPEA] = effadd_vec6;
        }
 
         /* if running on an amiga, make the NMI interrupt do nothing */
index e58654f3f8dd5c5e8444572a564c3eded86dd0c0..69d1d3d30c788cf03e373705597f49ea83ca07e2 100644 (file)
@@ -13,6 +13,7 @@ SECTIONS
   .text : {
        *(.text)
        SCHED_TEXT
+       LOCK_TEXT
        *(.fixup)
        *(.gnu.warning)
        } :text = 0x4e75
index cc37e8d3c1e2ad30a11989e220612d7a34bd37eb..65cc39c24185569f3141d3b9ea96a8ed5b66b21f 100644 (file)
@@ -14,6 +14,7 @@ SECTIONS
        *(.head)
        *(.text)
        SCHED_TEXT
+       LOCK_TEXT
        *(.fixup)
        *(.gnu.warning)
        } :text = 0x4e75
@@ -66,7 +67,7 @@ __init_begin = .;
        __initramfs_end = .;
        . = ALIGN(8192);
        __init_end = .;
-       .init.task : { *(init_task) }
+       .data.init.task : { *(.data.init_task) }
 
 
   .bss : { *(.bss) }           /* BSS */
index 4a5c5445c610fe42d92963ffb1cb7e2c85892b75..cb13c6e3ccaeb6449dd2d99898f9e1ee53eb50d5 100644 (file)
@@ -134,7 +134,7 @@ EXPORT_SYMBOL(csum_partial);
  */
 
 unsigned int
-csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst,
+csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst,
                            int len, int sum, int *csum_err)
 {
        /*
index cd19cbb213e811d33f3ee3981f59295ed35b4f4a..14f8d3f4e195f2424fbf18530d29070a10fd534f 100644 (file)
@@ -212,9 +212,6 @@ void __init config_mac(void)
        mach_reset           = mac_reset;
        mach_halt            = mac_poweroff;
        mach_power_off       = mac_poweroff;
-#ifdef CONFIG_DUMMY_CONSOLE
-       conswitchp               = &dummy_con;
-#endif
        mach_max_dma_address = 0xffffffff;
 #if 0
        mach_debug_init  = mac_debug_init;
index d889ba80ccdcdb33232833cba15b11202755f589..9179a37984074593dd01ddb1583814b69dcd628c 100644 (file)
@@ -293,8 +293,8 @@ void __init iop_init(void)
        }
 
        for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
-               iop_send_queue[IOP_NUM_SCC][i] = 0;
-               iop_send_queue[IOP_NUM_ISM][i] = 0;
+               iop_send_queue[IOP_NUM_SCC][i] = NULL;
+               iop_send_queue[IOP_NUM_ISM][i] = NULL;
                iop_listeners[IOP_NUM_SCC][i].devname = NULL;
                iop_listeners[IOP_NUM_SCC][i].handler = NULL;
                iop_listeners[IOP_NUM_ISM][i].devname = NULL;
index 5b80d7cd954a824d573a1ea311ef94b9cde42097..bbb0c3b95e9c141614b0a0d3989e952620b8787d 100644 (file)
 extern struct mac_booter_data mac_bi_data;
 static void (*rom_reset)(void);
 
-#ifdef CONFIG_ADB
-/*
- * Return the current time as the number of seconds since January 1, 1904.
- */
-
-static long adb_read_time(void)
+#ifdef CONFIG_ADB_CUDA
+static long cuda_read_time(void)
 {
-       volatile struct adb_request req;
+       struct adb_request req;
        long time;
 
-       adb_request((struct adb_request *) &req, NULL,
-                       ADBREQ_RAW|ADBREQ_SYNC,
-                       2, CUDA_PACKET, CUDA_GET_TIME);
+       if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0)
+               return 0;
+       while (!req.complete)
+               cuda_poll();
 
        time = (req.reply[3] << 24) | (req.reply[4] << 16)
                | (req.reply[5] << 8) | req.reply[6];
        return time - RTC_OFFSET;
 }
 
-/*
- * Set the current system time
- */
+static void cuda_write_time(long data)
+{
+       struct adb_request req;
+       data += RTC_OFFSET;
+       if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
+                       (data >> 24) & 0xFF, (data >> 16) & 0xFF,
+                       (data >> 8) & 0xFF, data & 0xFF) < 0)
+               return;
+       while (!req.complete)
+               cuda_poll();
+}
 
-static void adb_write_time(long data)
+static __u8 cuda_read_pram(int offset)
 {
-       volatile struct adb_request req;
+       struct adb_request req;
+       if (cuda_request(&req, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM,
+                       (offset >> 8) & 0xFF, offset & 0xFF) < 0)
+               return 0;
+       while (!req.complete)
+               cuda_poll();
+       return req.reply[3];
+}
 
-       data += RTC_OFFSET;
+static void cuda_write_pram(int offset, __u8 data)
+{
+       struct adb_request req;
+       if (cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM,
+                       (offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
+               return;
+       while (!req.complete)
+               cuda_poll();
+}
+#else
+#define cuda_read_time() 0
+#define cuda_write_time(n)
+#define cuda_read_pram NULL
+#define cuda_write_pram NULL
+#endif
+
+#ifdef CONFIG_ADB_PMU68K
+static long pmu_read_time(void)
+{
+       struct adb_request req;
+       long time;
+
+       if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
+               return 0;
+       while (!req.complete)
+               pmu_poll();
 
-       adb_request((struct adb_request *) &req, NULL,
-                       ADBREQ_RAW|ADBREQ_SYNC,
-                       6, CUDA_PACKET, CUDA_SET_TIME,
+       time = (req.reply[0] << 24) | (req.reply[1] << 16)
+               | (req.reply[2] << 8) | req.reply[3];
+       return time - RTC_OFFSET;
+}
+
+static void pmu_write_time(long data)
+{
+       struct adb_request req;
+       data += RTC_OFFSET;
+       if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
                        (data >> 24) & 0xFF, (data >> 16) & 0xFF,
-                       (data >> 8) & 0xFF, data & 0xFF);
+                       (data >> 8) & 0xFF, data & 0xFF) < 0)
+               return;
+       while (!req.complete)
+               pmu_poll();
 }
 
-/*
- * Get a byte from the NVRAM
- */
+static __u8 pmu_read_pram(int offset)
+{
+       struct adb_request req;
+       if (pmu_request(&req, NULL, 3, PMU_READ_NVRAM,
+                       (offset >> 8) & 0xFF, offset & 0xFF) < 0)
+               return 0;
+       while (!req.complete)
+               pmu_poll();
+       return req.reply[3];
+}
 
-static __u8 adb_read_pram(int offset)
+static void pmu_write_pram(int offset, __u8 data)
 {
-       volatile struct adb_request req;
+       struct adb_request req;
+       if (pmu_request(&req, NULL, 4, PMU_WRITE_NVRAM,
+                       (offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
+               return;
+       while (!req.complete)
+               pmu_poll();
+}
+#else
+#define pmu_read_time() 0
+#define pmu_write_time(n)
+#define pmu_read_pram NULL
+#define pmu_write_pram NULL
+#endif
 
-       adb_request((struct adb_request *) &req, NULL,
-                       ADBREQ_RAW|ADBREQ_SYNC,
-                       4, CUDA_PACKET, CUDA_GET_PRAM,
-                       (offset >> 8) & 0xFF, offset & 0xFF);
-       return req.reply[3];
+#ifdef CONFIG_ADB_MACIISI
+extern int maciisi_request(struct adb_request *req,
+                       void (*done)(struct adb_request *), int nbytes, ...);
+
+static long maciisi_read_time(void)
+{
+       struct adb_request req;
+       long time;
+
+       if (maciisi_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME))
+               return 0;
+
+       time = (req.reply[3] << 24) | (req.reply[4] << 16)
+               | (req.reply[5] << 8) | req.reply[6];
+       return time - RTC_OFFSET;
 }
 
-/*
- * Write a byte to the NVRAM
- */
+static void maciisi_write_time(long data)
+{
+       struct adb_request req;
+       data += RTC_OFFSET;
+       maciisi_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
+                       (data >> 24) & 0xFF, (data >> 16) & 0xFF,
+                       (data >> 8) & 0xFF, data & 0xFF);
+}
 
-static void adb_write_pram(int offset, __u8 data)
+static __u8 maciisi_read_pram(int offset)
 {
-       volatile struct adb_request req;
+       struct adb_request req;
+       if (maciisi_request(&req, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM,
+                       (offset >> 8) & 0xFF, offset & 0xFF))
+               return 0;
+       return req.reply[3];
+}
 
-       adb_request((struct adb_request *) &req, NULL,
-                       ADBREQ_RAW|ADBREQ_SYNC,
-                       5, CUDA_PACKET, CUDA_SET_PRAM,
-                       (offset >> 8) & 0xFF, offset & 0xFF,
-                       data);
+static void maciisi_write_pram(int offset, __u8 data)
+{
+       struct adb_request req;
+       maciisi_request(&req, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM,
+                       (offset >> 8) & 0xFF, offset & 0xFF, data);
 }
-#endif /* CONFIG_ADB */
+#else
+#define maciisi_read_time() 0
+#define maciisi_write_time(n)
+#define maciisi_read_pram NULL
+#define maciisi_write_pram NULL
+#endif
 
 /*
  * VIA PRAM/RTC access routines
@@ -305,42 +396,55 @@ static void oss_shutdown(void)
 
 static void cuda_restart(void)
 {
-       adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC,
-                       2, CUDA_PACKET, CUDA_RESET_SYSTEM);
+       struct adb_request req;
+       if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM) < 0)
+               return;
+       while (!req.complete)
+               cuda_poll();
 }
 
 static void cuda_shutdown(void)
 {
-       adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC,
-                       2, CUDA_PACKET, CUDA_POWERDOWN);
+       struct adb_request req;
+       if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN) < 0)
+               return;
+       while (!req.complete)
+               cuda_poll();
 }
 
 #endif /* CONFIG_ADB_CUDA */
 
-#ifdef CONFIG_ADB_PMU
+#ifdef CONFIG_ADB_PMU68K
 
 void pmu_restart(void)
 {
-       adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC,
-                       3, PMU_PACKET, PMU_SET_INTR_MASK,
-                       PMU_INT_ADB|PMU_INT_TICK);
-
-       adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC,
-                       2, PMU_PACKET, PMU_RESET);
+       struct adb_request req;
+       if (pmu_request(&req, NULL,
+                       2, PMU_SET_INTR_MASK, PMU_INT_ADB|PMU_INT_TICK) < 0)
+               return;
+       while (!req.complete)
+               pmu_poll();
+       if (pmu_request(&req, NULL, 1, PMU_RESET) < 0)
+               return;
+       while (!req.complete)
+               pmu_poll();
 }
 
 void pmu_shutdown(void)
 {
-       adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC,
-                       3, PMU_PACKET, PMU_SET_INTR_MASK,
-                       PMU_INT_ADB|PMU_INT_TICK);
-
-       adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC,
-                       6, PMU_PACKET, PMU_SHUTDOWN,
-                       'M', 'A', 'T', 'T');
+       struct adb_request req;
+       if (pmu_request(&req, NULL,
+                       2, PMU_SET_INTR_MASK, PMU_INT_ADB|PMU_INT_TICK) < 0)
+               return;
+       while (!req.complete)
+               pmu_poll();
+       if (pmu_request(&req, NULL, 5, PMU_SHUTDOWN, 'M', 'A', 'T', 'T') < 0)
+               return;
+       while (!req.complete)
+               pmu_poll();
 }
 
-#endif /* CONFIG_ADB_PMU */
+#endif
 
 /*
  *-------------------------------------------------------------------
@@ -351,21 +455,22 @@ void pmu_shutdown(void)
 
 void mac_pram_read(int offset, __u8 *buffer, int len)
 {
-       __u8 (*func)(int) = NULL;
+       __u8 (*func)(int);
        int i;
 
-       if (macintosh_config->adb_type == MAC_ADB_IISI ||
-           macintosh_config->adb_type == MAC_ADB_PB1 ||
-           macintosh_config->adb_type == MAC_ADB_PB2 ||
-           macintosh_config->adb_type == MAC_ADB_CUDA) {
-#ifdef CONFIG_ADB
-               func = adb_read_pram;
-#else
-               return;
-#endif
-       } else {
+       switch(macintosh_config->adb_type) {
+       case MAC_ADB_IISI:
+               func = maciisi_read_pram; break;
+       case MAC_ADB_PB1:
+       case MAC_ADB_PB2:
+               func = pmu_read_pram; break;
+       case MAC_ADB_CUDA:
+               func = cuda_read_pram; break;
+       default:
                func = via_read_pram;
        }
+       if (!func)
+               return;
        for (i = 0 ; i < len ; i++) {
                buffer[i] = (*func)(offset++);
        }
@@ -373,21 +478,22 @@ void mac_pram_read(int offset, __u8 *buffer, int len)
 
 void mac_pram_write(int offset, __u8 *buffer, int len)
 {
-       void (*func)(int, __u8) = NULL;
+       void (*func)(int, __u8);
        int i;
 
-       if (macintosh_config->adb_type == MAC_ADB_IISI ||
-           macintosh_config->adb_type == MAC_ADB_PB1 ||
-           macintosh_config->adb_type == MAC_ADB_PB2 ||
-           macintosh_config->adb_type == MAC_ADB_CUDA) {
-#ifdef CONFIG_ADB
-               func = adb_write_pram;
-#else
-               return;
-#endif
-       } else {
+       switch(macintosh_config->adb_type) {
+       case MAC_ADB_IISI:
+               func = maciisi_write_pram; break;
+       case MAC_ADB_PB1:
+       case MAC_ADB_PB2:
+               func = pmu_write_pram; break;
+       case MAC_ADB_CUDA:
+               func = cuda_write_pram; break;
+       default:
                func = via_write_pram;
        }
+       if (!func)
+               return;
        for (i = 0 ; i < len ; i++) {
                (*func)(offset++, buffer[i]);
        }
@@ -408,7 +514,7 @@ void mac_poweroff(void)
        } else if (macintosh_config->adb_type == MAC_ADB_CUDA) {
                cuda_shutdown();
 #endif
-#ifdef CONFIG_ADB_PMU
+#ifdef CONFIG_ADB_PMU68K
        } else if (macintosh_config->adb_type == MAC_ADB_PB1
                || macintosh_config->adb_type == MAC_ADB_PB2) {
                pmu_shutdown();
@@ -448,7 +554,7 @@ void mac_reset(void)
        } else if (macintosh_config->adb_type == MAC_ADB_CUDA) {
                cuda_restart();
 #endif
-#ifdef CONFIG_ADB_PMU
+#ifdef CONFIG_ADB_PMU68K
        } else if (macintosh_config->adb_type == MAC_ADB_PB1
                || macintosh_config->adb_type == MAC_ADB_PB2) {
                pmu_restart();
@@ -466,12 +572,13 @@ void mac_reset(void)
                /* make a 1-to-1 mapping, using the transparent tran. reg. */
                unsigned long virt = (unsigned long) mac_reset;
                unsigned long phys = virt_to_phys(mac_reset);
+               unsigned long addr = (phys&0xFF000000)|0x8777;
                unsigned long offset = phys-virt;
                local_irq_disable(); /* lets not screw this up, ok? */
                __asm__ __volatile__(".chip 68030\n\t"
                                     "pmove %0,%/tt0\n\t"
                                     ".chip 68k"
-                                    : : "m" ((phys&0xFF000000)|0x8777));
+                                    : : "m" (addr));
                /* Now jump to physical address so we can disable MMU */
                __asm__ __volatile__(
                     ".chip 68030\n\t"
@@ -588,20 +695,22 @@ int mac_hwclk(int op, struct rtc_time *t)
        unsigned long now;
 
        if (!op) { /* read */
-               if (macintosh_config->adb_type == MAC_ADB_II) {
+               switch (macintosh_config->adb_type) {
+               case MAC_ADB_II:
+               case MAC_ADB_IOP:
                        now = via_read_time();
-               } else
-#ifdef CONFIG_ADB
-               if ((macintosh_config->adb_type == MAC_ADB_IISI) ||
-                          (macintosh_config->adb_type == MAC_ADB_PB1) ||
-                          (macintosh_config->adb_type == MAC_ADB_PB2) ||
-                          (macintosh_config->adb_type == MAC_ADB_CUDA)) {
-                       now = adb_read_time();
-               } else
-#endif
-               if (macintosh_config->adb_type == MAC_ADB_IOP) {
-                       now = via_read_time();
-               } else {
+                       break;
+               case MAC_ADB_IISI:
+                       now = maciisi_read_time();
+                       break;
+               case MAC_ADB_PB1:
+               case MAC_ADB_PB2:
+                       now = pmu_read_time();
+                       break;
+               case MAC_ADB_CUDA:
+                       now = cuda_read_time();
+                       break;
+               default:
                        now = 0;
                }
 
@@ -619,15 +728,20 @@ int mac_hwclk(int op, struct rtc_time *t)
                now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
                             t->tm_hour, t->tm_min, t->tm_sec);
 
-               if (macintosh_config->adb_type == MAC_ADB_II) {
-                       via_write_time(now);
-               } else if ((macintosh_config->adb_type == MAC_ADB_IISI) ||
-                          (macintosh_config->adb_type == MAC_ADB_PB1) ||
-                          (macintosh_config->adb_type == MAC_ADB_PB2) ||
-                          (macintosh_config->adb_type == MAC_ADB_CUDA)) {
-                       adb_write_time(now);
-               } else if (macintosh_config->adb_type == MAC_ADB_IOP) {
+               switch (macintosh_config->adb_type) {
+               case MAC_ADB_II:
+               case MAC_ADB_IOP:
                        via_write_time(now);
+                       break;
+               case MAC_ADB_CUDA:
+                       cuda_write_time(now);
+                       break;
+               case MAC_ADB_PB1:
+               case MAC_ADB_PB2:
+                       pmu_write_time(now);
+                       break;
+               case MAC_ADB_IISI:
+                       maciisi_write_time(now);
                }
 #endif
        }
index 02251e5afd891f83bcfc304ed8f34a975f2cb809..4ad0ca918e2e3e08426c5dd012adec1c29781b9e 100644 (file)
@@ -366,7 +366,7 @@ static inline void fp_submant(struct fp_ext *dest, struct fp_ext *src1,
 
 #define fp_mul64(desth, destl, src1, src2) ({                          \
        asm ("mulu.l %2,%1:%0" : "=d" (destl), "=d" (desth)             \
-               : "g" (src1), "0" (src2));                              \
+               : "dm" (src1), "0" (src2));                             \
 })
 #define fp_div64(quot, rem, srch, srcl, div)                           \
        asm ("divu.l %2,%1:%0" : "=d" (quot), "=d" (rem)                \
index fe2383e36b0664d6586c02a3c54533c1d197753b..85ad19a0ac792ddc16e4a74be3854f3f752cd3cc 100644 (file)
@@ -102,7 +102,7 @@ static inline void free_io_area(void *addr)
  */
 /* Rewritten by Andreas Schwab to remove all races. */
 
-void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
+void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
 {
        struct vm_struct *area;
        unsigned long virtaddr, retaddr;
@@ -121,7 +121,7 @@ void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
        if (MACH_IS_AMIGA) {
                if ((physaddr >= 0x40000000) && (physaddr + size < 0x60000000)
                    && (cacheflag == IOMAP_NOCACHE_SER))
-                       return (void *)physaddr;
+                       return (void __iomem *)physaddr;
        }
 #endif
 
@@ -218,21 +218,21 @@ void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
 #endif
        flush_tlb_all();
 
-       return (void *)retaddr;
+       return (void __iomem *)retaddr;
 }
 
 /*
  * Unmap a ioremap()ed region again
  */
-void iounmap(void *addr)
+void iounmap(void __iomem *addr)
 {
 #ifdef CONFIG_AMIGA
        if ((!MACH_IS_AMIGA) ||
            (((unsigned long)addr < 0x40000000) ||
             ((unsigned long)addr > 0x60000000)))
-                       free_io_area(addr);
+                       free_io_area((__force void *)addr);
 #else
-       free_io_area(addr);
+       free_io_area((__force void *)addr);
 #endif
 }
 
index 7977eae50af27c2344bb432844493c1e8a8a2143..a69fe3048edce030e8d65d6403e75e291bd1176e 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/miscdevice.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
+#include <linux/capability.h>
 #include <linux/fcntl.h>
 #include <linux/init.h>
 #include <linux/poll.h>
@@ -44,6 +45,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        volatile MK48T08ptr_t rtc = (MK48T08ptr_t)MVME_RTC_BASE;
        unsigned long flags;
        struct rtc_time wtime;
+       void __user *argp = (void __user *)arg;
 
        switch (cmd) {
        case RTC_RD_TIME:       /* Read the time/date from RTC  */
@@ -63,7 +65,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                wtime.tm_wday = BCD2BIN(rtc->bcd_dow)-1;
                rtc->ctrl = 0;
                local_irq_restore(flags);
-               return copy_to_user((void *)arg, &wtime, sizeof wtime) ?
+               return copy_to_user(argp, &wtime, sizeof wtime) ?
                                                                -EFAULT : 0;
        }
        case RTC_SET_TIME:      /* Set the RTC */
@@ -75,8 +77,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                if (!capable(CAP_SYS_ADMIN))
                        return -EACCES;
 
-               if (copy_from_user(&rtc_tm, (struct rtc_time*)arg,
-                                  sizeof(struct rtc_time)))
+               if (copy_from_user(&rtc_tm, argp, sizeof(struct rtc_time)))
                        return -EFAULT;
 
                yrs = rtc_tm.tm_year;
index 02b626bae4ae9028dcd32029bec9ab9c615cea22..5e0f9b04d45e6adc0f94d2a23050831d124b365d 100644 (file)
@@ -36,8 +36,6 @@
 #include <asm/machdep.h>
 #include <asm/q40_master.h>
 
-extern void floppy_setup(char *str, int *ints);
-
 extern irqreturn_t q40_process_int (int level, struct pt_regs *regs);
 extern irqreturn_t (*q40_default_handler[]) (int, void *, struct pt_regs *);  /* added just for debugging */
 extern void q40_init_IRQ (void);
@@ -194,9 +192,6 @@ void __init config_q40(void)
     mach_heartbeat = q40_heartbeat;
 #endif
     mach_halt = q40_halt;
-#ifdef CONFIG_DUMMY_CONSOLE
-    conswitchp = &dummy_con;
-#endif
 
     /* disable a few things that SMSQ might have left enabled */
     q40_disable_irqs();
index 77d05bcc32214bb7f9fe979cbc88249324a75063..f1ca0dfbaa67f928b55ad62ea38d217b4a0ff982 100644 (file)
@@ -160,9 +160,6 @@ void __init config_sun3(void)
        mach_hwclk           =  sun3_hwclk;
        mach_halt            =  sun3_halt;
        mach_get_hardware_list = sun3_get_hardware_list;
-#if defined(CONFIG_DUMMY_CONSOLE)
-       conswitchp           = &dummy_con;
-#endif
 
        memory_start = ((((int)&_end) + 0x2000) & ~0x1fff);
 // PROM seems to want the last couple of physical pages. --m
index 0ef547f5494d85d732e99d61e764a5200cccb721..0920f5d33606d972fe349308dc76cefd93711195 100644 (file)
@@ -71,10 +71,6 @@ void __init config_sun3x(void)
        mach_get_model       = sun3_get_model;
        mach_get_hardware_list = sun3x_get_hardware_list;
 
-#ifdef CONFIG_DUMMY_CONSOLE
-       conswitchp           = &dummy_con;
-#endif
-
        sun3_intreg = (unsigned char *)SUN3X_INTREG;
 
        /* only the serial console is known to work anyway... */
index 8b3cf57ba706f04043a3da3f11e590ea5d7052a0..99bf43824795e0004b2850413ac3c84450f21362 100644 (file)
@@ -198,10 +198,9 @@ int copy_thread(int nr, unsigned long clone_flags,
 {
        struct pt_regs * childregs;
        struct switch_stack * childstack, *stack;
-       unsigned long stack_offset, *retp;
+       unsigned long *retp;
 
-       stack_offset = THREAD_SIZE - sizeof(struct pt_regs);
-       childregs = (struct pt_regs *) ((unsigned long) p->thread_info + stack_offset);
+       childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
 
        *childregs = *regs;
        childregs->d0 = 0;
index 0476a4dce14e47ac53e811f9a5a63feb9d98b605..fa98f10d0132262da989f9110a46c2b9ddbb6bd5 100644 (file)
@@ -140,12 +140,12 @@ void flush_thread(void)
 int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
        unsigned long unused, struct task_struct *p, struct pt_regs *regs)
 {
-       struct thread_info *ti = p->thread_info;
+       struct thread_info *ti = task_thread_info(p);
        struct pt_regs *childregs;
        long childksp;
        p->set_child_tid = p->clear_child_tid = NULL;
 
-       childksp = (unsigned long)ti + THREAD_SIZE - 32;
+       childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32;
 
        preempt_disable();
 
@@ -229,9 +229,7 @@ void elf_dump_regs(elf_greg_t *gp, struct pt_regs *regs)
 
 int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs)
 {
-       struct thread_info *ti = tsk->thread_info;
-       long ksp = (unsigned long)ti + THREAD_SIZE - 32;
-       elf_dump_regs(&(*regs)[0], (struct pt_regs *) ksp - 1);
+       elf_dump_regs(*regs, task_pt_regs(tsk));
        return 1;
 }
 
@@ -409,7 +407,7 @@ unsigned long get_wchan(struct task_struct *p)
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;
 
-       stack_page = (unsigned long)p->thread_info;
+       stack_page = (unsigned long)task_stack_page(p);
        if (!stack_page || !mips_frame_info_initialized)
                return 0;
 
index 8d25493353040597a240a631c18b9340d38be30c..f838b36cc765bcbc9ad544701aec14e2ff29c278 100644 (file)
@@ -64,8 +64,7 @@ int ptrace_getregs (struct task_struct *child, __s64 __user *data)
        if (!access_ok(VERIFY_WRITE, data, 38 * 8))
                return -EIO;
 
-       regs = (struct pt_regs *) ((unsigned long) child->thread_info +
-              THREAD_SIZE - 32 - sizeof(struct pt_regs));
+       regs = task_pt_regs(child);
 
        for (i = 0; i < 32; i++)
                __put_user (regs->regs[i], data + i);
@@ -92,8 +91,7 @@ int ptrace_setregs (struct task_struct *child, __s64 __user *data)
        if (!access_ok(VERIFY_READ, data, 38 * 8))
                return -EIO;
 
-       regs = (struct pt_regs *) ((unsigned long) child->thread_info +
-              THREAD_SIZE - 32 - sizeof(struct pt_regs));
+       regs = task_pt_regs(child);
 
        for (i = 0; i < 32; i++)
                __get_user (regs->regs[i], data + i);
@@ -198,8 +196,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                struct pt_regs *regs;
                unsigned long tmp = 0;
 
-               regs = (struct pt_regs *) ((unsigned long) child->thread_info +
-                      THREAD_SIZE - 32 - sizeof(struct pt_regs));
+               regs = task_pt_regs(child);
                ret = 0;  /* Default return value. */
 
                switch (addr) {
@@ -314,8 +311,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        case PTRACE_POKEUSR: {
                struct pt_regs *regs;
                ret = 0;
-               regs = (struct pt_regs *) ((unsigned long) child->thread_info +
-                      THREAD_SIZE - 32 - sizeof(struct pt_regs));
+               regs = task_pt_regs(child);
 
                switch (addr) {
                case 0 ... 31:
@@ -442,7 +438,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                break;
 
        case PTRACE_GET_THREAD_AREA:
-               ret = put_user(child->thread_info->tp_value,
+               ret = put_user(task_thread_info(child)->tp_value,
                                (unsigned long __user *) data);
                break;
 
index 1f998bfde1656d88702c19e6b6deb34e50685217..0c82b25d8c6d17c087f5c3ec0c704052dbd22bd3 100644 (file)
@@ -126,8 +126,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
                struct pt_regs *regs;
                unsigned int tmp;
 
-               regs = (struct pt_regs *) ((unsigned long) child->thread_info +
-                      THREAD_SIZE - 32 - sizeof(struct pt_regs));
+               regs = task_pt_regs(child);
                ret = 0;  /* Default return value. */
 
                switch (addr) {
@@ -259,8 +258,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
        case PTRACE_POKEUSR: {
                struct pt_regs *regs;
                ret = 0;
-               regs = (struct pt_regs *) ((unsigned long) child->thread_info +
-                      THREAD_SIZE - 32 - sizeof(struct pt_regs));
+               regs = task_pt_regs(child);
 
                switch (addr) {
                case 0 ... 31:
@@ -377,7 +375,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
                break;
 
        case PTRACE_GET_THREAD_AREA:
-               ret = put_user(child->thread_info->tp_value,
+               ret = put_user(task_thread_info(child)->tp_value,
                                (unsigned int __user *) (unsigned long) data);
                break;
 
@@ -391,7 +389,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
                break;
 
        case PTRACE_GET_THREAD_AREA_3264:
-               ret = put_user(child->thread_info->tp_value,
+               ret = put_user(task_thread_info(child)->tp_value,
                                (unsigned long __user *) (unsigned long) data);
                break;
 
index d429544ba4bcc7ed99e2abeeab5a2906366c9e78..794a1c3de2a493b62ac2f60f38c3665d30763489 100644 (file)
@@ -287,6 +287,7 @@ void prom_prepare_cpus(unsigned int max_cpus)
  */
 void prom_boot_secondary(int cpu, struct task_struct *idle)
 {
+       struct thread_info *gp = task_thread_info(idle);
        dvpe();
        set_c0_mvpcontrol(MVPCONTROL_VPC);
 
@@ -307,11 +308,9 @@ void prom_boot_secondary(int cpu, struct task_struct *idle)
        write_tc_gpr_sp( __KSTK_TOS(idle));
 
        /* global pointer */
-       write_tc_gpr_gp((unsigned long)idle->thread_info);
+       write_tc_gpr_gp((unsigned long)gp);
 
-       flush_icache_range((unsigned long)idle->thread_info,
-                                          (unsigned long)idle->thread_info +
-                                          sizeof(struct thread_info));
+       flush_icache_range((unsigned long)gp, (unsigned long)(gp + 1));
 
        /* finally out of configuration and into chaos */
        clear_c0_mvpcontrol(MVPCONTROL_VPC);
index ee98eeb65e85f833009c7d3226fbb614db73e65a..332358430ff5122a3639ccdb8a7ead2e8db03fd7 100644 (file)
@@ -9,6 +9,7 @@
  */
 #include <linux/config.h>
 #include <linux/a.out.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/linkage.h>
 #include <linux/mm.h>
@@ -262,7 +263,7 @@ asmlinkage int sys_olduname(struct oldold_utsname * name)
 
 void sys_set_thread_area(unsigned long addr)
 {
-       struct thread_info *ti = current->thread_info;
+       struct thread_info *ti = task_thread_info(current);
 
        ti->tp_value = addr;
 
index 52924f8ce23c23bc6a53fcfd5e948df2608dc736..0fc3730a294f245bb0d041500207266a3d195a9d 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/binfmts.h>
+#include <linux/capability.h>
 #include <linux/highuid.h>
 #include <linux/pagemap.h>
 #include <linux/mm.h>
index 7058893d5ad2227259746895558f47644e6d66bd..59a187956de028cc4812a8822aea55fcfa5d68e0 100644 (file)
@@ -519,7 +519,7 @@ static inline int simulate_llsc(struct pt_regs *regs)
  */
 static inline int simulate_rdhwr(struct pt_regs *regs)
 {
-       struct thread_info *ti = current->thread_info;
+       struct thread_info *ti = task_thread_info(current);
        unsigned int opcode;
 
        if (unlikely(get_insn_opcode(regs, &opcode)))
index 0527170d6adb46fee7165b22b925c3d0f72c61df..f17f575f58f0a17ddfb700549110c07feb4afad1 100644 (file)
@@ -93,8 +93,8 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
  */
 void prom_boot_secondary(int cpu, struct task_struct *idle)
 {
-       unsigned long gp = (unsigned long) idle->thread_info;
-       unsigned long sp = gp + THREAD_SIZE - 32;
+       unsigned long gp = (unsigned long) task_thread_info(idle);
+       unsigned long sp = __KSTK_TOP(idle);
 
        secondary_sp = sp;
        secondary_gp = gp;
index 3a8291b7d26d1aa84122bdbfa7a516cb3eb62cd9..dbef3f6b565022341ce983521a9314b76813c748 100644 (file)
@@ -168,8 +168,8 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
  */
 void __init prom_boot_secondary(int cpu, struct task_struct *idle)
 {
-       unsigned long gp = (unsigned long) idle->thread_info;
-       unsigned long sp = gp + THREAD_SIZE - 32;
+       unsigned long gp = (unsigned long)task_thread_info(idle);
+       unsigned long sp = __KSTK_TOS(idle);
 
        LAUNCH_SLAVE(cputonasid(cpu),cputoslice(cpu),
                (launch_proc_t)MAPPED_KERN_RW_TO_K0(smp_bootstrap),
index e8485124b8fc903fda4b8768825f080ff19c5a5b..4477af3d8074fbd067d38d29b9b8936693c3b527 100644 (file)
@@ -60,7 +60,7 @@ void prom_boot_secondary(int cpu, struct task_struct *idle)
 
        retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap,
                               __KSTK_TOS(idle),
-                              (unsigned long)idle->thread_info, 0);
+                              (unsigned long)task_thread_info(idle), 0);
        if (retval != 0)
                printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval);
 }
index a64fd48fbfb5625d6cb4741bf0237ea8eb79c2a0..29b4d61898f2ca0b76e64dda8abcbab7ac48a76e 100644 (file)
@@ -22,6 +22,7 @@
  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/capability.h>
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/namei.h>
index 79dcbcccecb8677b3456135fa5398d54b7bdc45a..11d406cd0b3e73acfd348c3736d6d71a66b7970b 100644 (file)
@@ -42,6 +42,7 @@
  *  on every box. 
  */
 
+#include <linux/capability.h>
 #include <linux/init.h>
 #include <linux/proc_fs.h>
 #include <linux/miscdevice.h>
index 4eb70a40ec7eceacc4fd029a7d0b8e6a6f4eaf91..5da41677e70bd36201d9fd729345664d4c4b6781 100644 (file)
@@ -295,7 +295,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
            struct task_struct * p, struct pt_regs * pregs)
 {
        struct pt_regs * cregs = &(p->thread.regs);
-       struct thread_info *ti = p->thread_info;
+       void *stack = task_stack_page(p);
        
        /* We have to use void * instead of a function pointer, because
         * function pointers aren't a pointer to the function on 64-bit.
@@ -322,7 +322,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
         */
        if (usp == 1) {
                /* kernel thread */
-               cregs->ksp = (((unsigned long)(ti)) + THREAD_SZ_ALGN);
+               cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN;
                /* Must exit via ret_from_kernel_thread in order
                 * to call schedule_tail()
                 */
@@ -344,7 +344,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
                 */
 
                /* Use same stack depth as parent */
-               cregs->ksp = ((unsigned long)(ti))
+               cregs->ksp = (unsigned long)stack
                        + (pregs->gr[21] & (THREAD_SIZE - 1));
                cregs->gr[30] = usp;
                if (p->personality == PER_HPUX) {
index 17f23c26f1ca907efa041bc827ffea23b3a58626..25564b7ca6bbc084f60a25978431c20b5e163f90 100644 (file)
@@ -517,7 +517,7 @@ int __init smp_boot_one_cpu(int cpuid)
        if (IS_ERR(idle))
                panic("SMP: fork failed for CPU:%d", cpuid);
 
-       idle->thread_info->cpu = cpuid;
+       task_thread_info(idle)->cpu = cpuid;
 
        /* Let _start know what logical CPU we're booting
        ** (offset into init_tasks[],cpu_data[])
index 935d965715154ea784aaf66e2a78afe8d596403c..01feed0e2a15a9bf45f48f701a36f7384f8c9adc 100644 (file)
@@ -71,15 +71,39 @@ config ARCH_MAY_HAVE_PC_FDC
        bool
        default y
 
+config PPC_OF
+       def_bool y
+
+config PPC_UDBG_16550
+       bool
+       default n
+
+config CRASH_DUMP
+       bool "kernel crash dumps (EXPERIMENTAL)"
+       depends on PPC_MULTIPLATFORM
+       depends on EXPERIMENTAL
+       help
+         Build a kernel suitable for use as a kdump capture kernel.
+         The kernel will be linked at a different address than normal, and
+         so can only be used for Kdump.
+
+         Don't change this unless you know what you are doing.
+
+config GENERIC_TBSYNC
+       bool
+       default y if PPC32 && SMP
+       default n
+
 menu "Processor support"
 choice
        prompt "Processor Type"
        depends on PPC32
        default 6xx
 
-config 6xx
+config CLASSIC32
        bool "6xx/7xx/74xx"
        select PPC_FPU
+       select 6xx
        help
          There are four families of PowerPC chips supported.  The more common
          types (601, 603, 604, 740, 750, 7400), the Motorola embedded
@@ -93,12 +117,20 @@ config 6xx
 
 config PPC_52xx
        bool "Freescale 52xx"
+       select 6xx
+       select PPC_FPU
        
 config PPC_82xx
        bool "Freescale 82xx"
+       select 6xx
+       select PPC_FPU
 
 config PPC_83xx
        bool "Freescale 83xx"
+       select 6xx
+       select FSL_SOC
+       select 83xx
+       select PPC_FPU
 
 config 40x
        bool "AMCC 40x"
@@ -134,6 +166,13 @@ config POWER4
        depends on PPC64
        def_bool y
 
+config 6xx
+       bool
+
+# this is temp to handle compat with arch=ppc
+config 83xx
+       bool
+
 config PPC_FPU
        bool
        default y if PPC64
@@ -166,7 +205,7 @@ config PHYS_64BIT
 
 config ALTIVEC
        bool "AltiVec Support"
-       depends on 6xx || POWER4
+       depends on CLASSIC32 || POWER4
        ---help---
          This option enables kernel support for the Altivec extensions to the
          PowerPC processor. The kernel currently supports saving and restoring
@@ -239,7 +278,7 @@ endmenu
 source "init/Kconfig"
 
 menu "Platform support"
-       depends on PPC64 || 6xx
+       depends on PPC64 || CLASSIC32
 
 choice
        prompt "Machine type"
@@ -330,9 +369,6 @@ config PPC_CELL
        select MMIO_NVRAM
        select PPC_UDBG_16550
 
-config PPC_OF
-       def_bool y
-
 config XICS
        depends on PPC_PSERIES
        bool
@@ -375,26 +411,11 @@ config MPIC_BROKEN_U3
        depends on PPC_MAPLE
        default y
 
-config PPC_UDBG_16550
-       bool
-       default n
-
 config CELL_IIC
        depends on PPC_CELL
        bool
        default y
 
-config CRASH_DUMP
-       bool "kernel crash dumps (EXPERIMENTAL)"
-       depends on PPC_MULTIPLATFORM
-       depends on EXPERIMENTAL
-       help
-         Build a kernel suitable for use as a kdump capture kernel.
-         The kernel will be linked at a different address than normal, and
-         so can only be used for Kdump.
-
-         Don't change this unless you know what you are doing.
-
 config IBMVIO
        depends on PPC_PSERIES || PPC_ISERIES
        bool
@@ -410,11 +431,6 @@ config PPC_MPC106
        bool
        default n
 
-config GENERIC_TBSYNC
-       bool
-       default y if PPC32 && SMP
-       default n
-
 source "drivers/cpufreq/Kconfig"
 
 config CPU_FREQ_PMAC
@@ -495,6 +511,7 @@ endmenu
 
 source arch/powerpc/platforms/embedded6xx/Kconfig
 source arch/powerpc/platforms/4xx/Kconfig
+source arch/powerpc/platforms/83xx/Kconfig
 source arch/powerpc/platforms/85xx/Kconfig
 source arch/powerpc/platforms/8xx/Kconfig
 source arch/powerpc/platforms/cell/Kconfig
@@ -718,7 +735,7 @@ config PPC_I8259
 config PPC_INDIRECT_PCI
        bool
        depends on PCI
-       default y if 40x || 44x || 85xx || 83xx
+       default y if 40x || 44x || 85xx
        default n
 
 config EISA
@@ -727,13 +744,16 @@ config EISA
 config SBUS
        bool
 
+config FSL_SOC
+       bool
+
 # Yes MCA RS/6000s exist but Linux-PPC does not currently support any
 config MCA
        bool
 
 config PCI
-       bool "PCI support" if 40x || CPM2 || 83xx || 85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES)
-       default y if !40x && !CPM2 && !8xx && !APUS && !83xx && !85xx
+       bool "PCI support" if 40x || CPM2 || PPC_83xx || 85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES)
+       default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !85xx
        default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS
        default PCI_QSPAN if !4xx && !CPM2 && 8xx
        help
@@ -746,11 +766,6 @@ config PCI_DOMAINS
        bool
        default PCI
 
-config MPC83xx_PCI2
-       bool "  Supprt for 2nd PCI host controller"
-       depends on PCI && MPC834x
-       default y if MPC834x_SYS
-
 config PCI_QSPAN
        bool "QSpan PCI"
        depends on !4xx && !CPM2 && 8xx
index 30a30bf559eaa161d4678c4faad74a3e286616e5..9254806f70326502f203b13cdcb3f580d7ad9a7d 100644 (file)
@@ -115,4 +115,46 @@ config PPC_OCP
        depends on IBM_OCP || XILINX_OCP
        default y
 
+choice
+       prompt "Early debugging (dangerous)"
+       bool
+       optional
+       help
+         Enable early debugging. Careful, if you enable debugging for the
+         wrong type of machine your kernel _will not boot_.
+
+config PPC_EARLY_DEBUG_LPAR
+       bool "LPAR HV Console"
+       depends on PPC_PSERIES
+       help
+         Select this to enable early debugging for a machine with a HVC
+         console on vterm 0.
+
+config PPC_EARLY_DEBUG_G5
+       bool "Apple G5"
+       depends on PPC_PMAC64
+       help
+         Select this to enable early debugging for Apple G5 machines.
+
+config PPC_EARLY_DEBUG_RTAS
+       bool "RTAS Panel"
+       depends on PPC_RTAS
+       help
+         Select this to enable early debugging via the RTAS panel.
+
+config PPC_EARLY_DEBUG_MAPLE
+       bool "Maple real mode"
+       depends on PPC_MAPLE
+       help
+         Select this to enable early debugging for Maple.
+
+config PPC_EARLY_DEBUG_ISERIES
+       bool "iSeries HV Console"
+       depends on PPC_ISERIES
+       help
+         Select this to enable early debugging for legacy iSeries. You need
+         to hit "Ctrl-x Ctrl-x" to see the messages on the console.
+
+endchoice
+
 endmenu
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
new file mode 100644 (file)
index 0000000..45c9ad2
--- /dev/null
@@ -0,0 +1,20 @@
+addnote
+infblock.c
+infblock.h
+infcodes.c
+infcodes.h
+inffast.c
+inffast.h
+inflate.c
+inftrees.c
+inftrees.h
+infutil.c
+infutil.h
+kernel-vmlinux.strip.c
+kernel-vmlinux.strip.gz
+uImage
+zImage
+zImage.vmode
+zconf.h
+zlib.h
+zutil.h
index 22726aefc8ea6d3cb68cb8808a0b0859343cafce..b53d677f6742d521867e9512be1e86e45041eae4 100644 (file)
@@ -176,4 +176,4 @@ $(obj)/uImage: $(obj)/vmlinux.gz
 install: $(CONFIGURE) $(BOOTIMAGE)
        sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
 
-clean-files := $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip)
+clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip)
index 347f4391db8d656092c35fec26f8ec210d74ee63..0b2b55a79c3cd9b6ba2659cad70dd877b40530e2 100644 (file)
@@ -878,7 +878,7 @@ CONFIG_HVCS=m
 #
 # CONFIG_WATCHDOG is not set
 # CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
+CONFIG_GEN_RTC=y
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
index 144e284d21dde7889b1353f1c14ce1a558bd66cc..bbfa1bdceb4d1b586132beb2cb0d8c4fc26fe202 100644 (file)
@@ -61,9 +61,9 @@ obj-$(CONFIG_MODULES)         += $(module-y)
 pci64-$(CONFIG_PPC64)          += pci_64.o pci_dn.o pci_iommu.o \
                                   pci_direct_iommu.o iomap.o
 obj-$(CONFIG_PCI)              += $(pci64-y)
-kexec-$(CONFIG_PPC64)          := machine_kexec_64.o
+kexec-$(CONFIG_PPC64)          := machine_kexec_64.o crash.o
 kexec-$(CONFIG_PPC32)          := machine_kexec_32.o
-obj-$(CONFIG_KEXEC)            += machine_kexec.o crash.o $(kexec-y)
+obj-$(CONFIG_KEXEC)            += machine_kexec.o $(kexec-y)
 
 ifeq ($(CONFIG_PPC_ISERIES),y)
 $(obj)/head_64.o: $(obj)/lparmap.s
index 4681155121efac866a503b5c673258437238a16c..5f248e3fdf821abfc71a3041a3569762c2d4807d 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/kexec.h>
 #include <linux/bootmem.h>
 #include <linux/crash_dump.h>
-#include <linux/irq.h>
 #include <linux/delay.h>
 #include <linux/elf.h>
 #include <linux/elfcore.h>
@@ -30,6 +29,7 @@
 #include <asm/kdump.h>
 #include <asm/lmb.h>
 #include <asm/firmware.h>
+#include <asm/smp.h>
 
 #ifdef DEBUG
 #include <asm/udbg.h>
index 87effa3f21a70db3efc49668567a2892f440a98b..211d72653ea684c6324557907abd29238eea237d 100644 (file)
@@ -55,6 +55,7 @@ void __init kdump_setup(void)
        DBG(" <- kdump_setup()\n");
 }
 
+#ifdef CONFIG_PROC_VMCORE
 static int __init parse_elfcorehdr(char *p)
 {
        if (p)
@@ -63,6 +64,7 @@ static int __init parse_elfcorehdr(char *p)
        return 0;
 }
 __setup("elfcorehdr=", parse_elfcorehdr);
+#endif
 
 static int __init parse_savemaxmem(char *p)
 {
index 27b0c40601fb5d6db8a13b9915ad2d626152173f..cfab48566db1306c3e8f47b5034ca703a67f471b 100644 (file)
@@ -179,6 +179,18 @@ static inline int kprobe_handler(struct pt_regs *regs)
                        kcb->kprobe_status = KPROBE_REENTER;
                        return 1;
                } else {
+                       if (*addr != BREAKPOINT_INSTRUCTION) {
+                               /* If trap variant, then it belongs not to us */
+                               kprobe_opcode_t cur_insn = *addr;
+                               if (is_trap(cur_insn))
+                                       goto no_kprobe;
+                               /* The breakpoint instruction was removed by
+                                * another cpu right after we hit, no further
+                                * handling of this interrupt is appropriate
+                                */
+                               ret = 1;
+                               goto no_kprobe;
+                       }
                        p = __get_cpu_var(current_kprobe);
                        if (p->break_handler && p->break_handler(p, regs)) {
                                goto ss_probe;
index a91e40c9ae45ee6f2c5fa38f799e5d3c0fb7c4ad..a81ca1b841ec89a0c5eff398b676dac5a3ae85fc 100644 (file)
 #include <linux/threads.h>
 #include <asm/machdep.h>
 
-/*
- * Provide a dummy crash_notes definition until crash dump is implemented.
- * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
- */
-note_buf_t crash_notes[NR_CPUS];
-
 void machine_crash_shutdown(struct pt_regs *regs)
 {
        if (ppc_md.machine_crash_shutdown)
index ba21a6c4f4672be54309a6710c0444eb4176aa40..24fe70f40b665320c60142131d8e4fb01592df63 100644 (file)
@@ -271,6 +271,9 @@ void __devinit pcibios_claim_one_bus(struct pci_bus *b)
        list_for_each_entry(child_bus, &b->children, node)
                pcibios_claim_one_bus(child_bus);
 }
+#ifdef CONFIG_HOTPLUG
+EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
+#endif
 
 #ifndef CONFIG_PPC_ISERIES
 static void __init pcibios_claim_of_setup(void)
index 105d5609ff572dc63c2919808fffd2c89f019dbc..1f816f0d7740eb4e7a9601a34faabcb9f4995a69 100644 (file)
@@ -424,7 +424,7 @@ void show_regs(struct pt_regs * regs)
        if (trap == 0x300 || trap == 0x600)
                printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
        printk("TASK = %p[%d] '%s' THREAD: %p",
-              current, current->pid, current->comm, current->thread_info);
+              current, current->pid, current->comm, task_thread_info(current));
 
 #ifdef CONFIG_SMP
        printk(" CPU: %d", smp_processor_id());
@@ -503,7 +503,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 {
        struct pt_regs *childregs, *kregs;
        extern void ret_from_fork(void);
-       unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
+       unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
 
        CHECK_FULL_REGS(regs);
        /* Copy registers */
@@ -516,7 +516,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 #ifdef CONFIG_PPC32
                childregs->gpr[2] = (unsigned long) p;
 #else
-               clear_ti_thread_flag(p->thread_info, TIF_32BIT);
+               clear_tsk_thread_flag(p, TIF_32BIT);
 #endif
                p->thread.regs = NULL;  /* no user register state */
        } else {
@@ -588,10 +588,8 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
         * set.  Do it now.
         */
        if (!current->thread.regs) {
-               unsigned long childregs = (unsigned long)current->thread_info +
-                                               THREAD_SIZE;
-               childregs -= sizeof(struct pt_regs);
-               current->thread.regs = (struct pt_regs *)childregs;
+               struct pt_regs *regs = task_stack_page(current) + THREAD_SIZE;
+               current->thread.regs = regs - 1;
        }
 
        memset(regs->gpr, 0, sizeof(regs->gpr));
@@ -767,7 +765,7 @@ out:
 static int validate_sp(unsigned long sp, struct task_struct *p,
                       unsigned long nbytes)
 {
-       unsigned long stack_page = (unsigned long)p->thread_info;
+       unsigned long stack_page = (unsigned long)task_stack_page(p);
 
        if (sp >= stack_page + sizeof(struct thread_struct)
            && sp <= stack_page + THREAD_SIZE - nbytes)
index b1babb7296733632baeaa2ea60a21e0399bc60e0..5ccbdbe0d5c96c9e063a99ccbf66e20ecb53f83e 100644 (file)
@@ -62,7 +62,7 @@ static inline void set_single_step(struct task_struct *task)
        struct pt_regs *regs = task->thread.regs;
        if (regs != NULL)
                regs->msr |= MSR_SE;
-       set_ti_thread_flag(task->thread_info, TIF_SINGLESTEP);
+       set_tsk_thread_flag(task, TIF_SINGLESTEP);
 }
 
 static inline void clear_single_step(struct task_struct *task)
@@ -70,7 +70,7 @@ static inline void clear_single_step(struct task_struct *task)
        struct pt_regs *regs = task->thread.regs;
        if (regs != NULL)
                regs->msr &= ~MSR_SE;
-       clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP);
+       clear_tsk_thread_flag(task, TIF_SINGLESTEP);
 }
 
 #ifdef CONFIG_ALTIVEC
index ae2e2a31a705d9360b2d69225d8c7a6c45ecf45a..4b9cfe4637b1fcff56cf698f15e250101d28ffe5 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/spinlock.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/capability.h>
 #include <linux/delay.h>
 
 #include <asm/prom.h>
@@ -29,6 +30,7 @@
 #include <asm/delay.h>
 #include <asm/uaccess.h>
 #include <asm/lmb.h>
+#include <asm/udbg.h>
 
 struct rtas_t rtas = {
        .lock = SPIN_LOCK_UNLOCKED
@@ -52,7 +54,7 @@ EXPORT_SYMBOL(rtas_flash_term_hook);
  * are designed only for very early low-level debugging, which
  * is why the token is hard-coded to 10.
  */
-void call_rtas_display_status(unsigned char c)
+static void call_rtas_display_status(char c)
 {
        struct rtas_args *args = &rtas.args;
        unsigned long s;
@@ -65,14 +67,14 @@ void call_rtas_display_status(unsigned char c)
        args->nargs = 1;
        args->nret  = 1;
        args->rets  = (rtas_arg_t *)&(args->args[1]);
-       args->args[0] = (int)c;
+       args->args[0] = (unsigned char)c;
 
        enter_rtas(__pa(args));
 
        spin_unlock_irqrestore(&rtas.lock, s);
 }
 
-void call_rtas_display_status_delay(unsigned char c)
+static void call_rtas_display_status_delay(char c)
 {
        static int pending_newline = 0;  /* did last write end with unprinted newline? */
        static int width = 16;
@@ -96,6 +98,11 @@ void call_rtas_display_status_delay(unsigned char c)
        }
 }
 
+void __init udbg_init_rtas(void)
+{
+       udbg_putc = call_rtas_display_status_delay;
+}
+
 void rtas_progress(char *s, unsigned short hex)
 {
        struct device_node *root;
index c4b76961d6de78f57e86c256211d4e0844f7ed22..e29b275e09e01a9400f12d99f9322b81ed845ef2 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/unistd.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
+#include <linux/bootmem.h>
 #include <asm/io.h>
 #include <asm/kdump.h>
 #include <asm/prom.h>
 #define DBG(fmt...)
 #endif
 
-/*
- * Here are some early debugging facilities. You can enable one
- * but your kernel will not boot on anything else if you do so
- */
-
-/* This one is for use on LPAR machines that support an HVC console
- * on vterm 0
- */
-extern void udbg_init_debug_lpar(void);
-/* This one is for use on Apple G5 machines
- */
-extern void udbg_init_pmac_realmode(void);
-/* That's RTAS panel debug */
-extern void call_rtas_display_status_delay(unsigned char c);
-/* Here's maple real mode debug */
-extern void udbg_init_maple_realmode(void);
-
-#define EARLY_DEBUG_INIT() do {} while(0)
-
-#if 0
-#define EARLY_DEBUG_INIT() udbg_init_debug_lpar()
-#define EARLY_DEBUG_INIT() udbg_init_maple_realmode()
-#define EARLY_DEBUG_INIT() udbg_init_pmac_realmode()
-#define EARLY_DEBUG_INIT()                                             \
-       do { udbg_putc = call_rtas_display_status_delay; } while(0)
-#endif
-
 int have_of = 1;
 int boot_cpuid = 0;
 int boot_cpuid_phys = 0;
@@ -237,11 +211,8 @@ void __init early_setup(unsigned long dt_ptr)
        struct paca_struct *lpaca = get_paca();
        static struct machdep_calls **mach;
 
-       /*
-        * Enable early debugging if any specified (see top of
-        * this file)
-        */
-       EARLY_DEBUG_INIT();
+       /* Enable early debugging if any specified (see udbg.h) */
+       udbg_early_init();
 
        DBG(" -> early_setup()\n");
 
@@ -684,3 +655,28 @@ void cpu_die(void)
        if (ppc_md.cpu_die)
                ppc_md.cpu_die();
 }
+
+#ifdef CONFIG_SMP
+void __init setup_per_cpu_areas(void)
+{
+       int i;
+       unsigned long size;
+       char *ptr;
+
+       /* Copy section for each CPU (we discard the original) */
+       size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
+#ifdef CONFIG_MODULES
+       if (size < PERCPU_ENOUGH_ROOM)
+               size = PERCPU_ENOUGH_ROOM;
+#endif
+
+       for_each_cpu(i) {
+               ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size);
+               if (!ptr)
+                       panic("Cannot allocate cpu data for CPU %d\n", i);
+
+               paca[i].data_offset = ptr - __per_cpu_start;
+               memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
+       }
+}
+#endif
index d381ec90b759e27fe5242d9f7c3e66bb4b7ca939..c8458c531b255f3dbb97b94b5023ead71b6f5193 100644 (file)
@@ -338,8 +338,8 @@ static void __init smp_create_idle(unsigned int cpu)
 #ifdef CONFIG_PPC64
        paca[cpu].__current = p;
 #endif
-       current_set[cpu] = p->thread_info;
-       p->thread_info->cpu = cpu;
+       current_set[cpu] = task_thread_info(p);
+       task_thread_info(p)->cpu = cpu;
 }
 
 void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -375,7 +375,7 @@ void __devinit smp_prepare_boot_cpu(void)
 #ifdef CONFIG_PPC64
        paca[boot_cpuid].__current = current;
 #endif
-       current_set[boot_cpuid] = current->thread_info;
+       current_set[boot_cpuid] = task_thread_info(current);
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
index 558c1ceb2b93fb046b96971235af929a00247dc2..3774e80094f5393bc86395fbd0632420a1992917 100644 (file)
 #include <linux/sched.h>
 #include <linux/console.h>
 #include <asm/processor.h>
+#include <asm/udbg.h>
 
 void (*udbg_putc)(char c);
 int (*udbg_getc)(void);
 int (*udbg_getc_poll)(void);
 
+/*
+ * Early debugging facilities. You can enable _one_ of these via .config,
+ * if you do so your kernel _will not boot_ on anything else. Be careful.
+ */
+void __init udbg_early_init(void)
+{
+#if defined(CONFIG_PPC_EARLY_DEBUG_LPAR)
+       /* For LPAR machines that have an HVC console on vterm 0 */
+       udbg_init_debug_lpar();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_G5)
+       /* For use on Apple G5 machines */
+       udbg_init_pmac_realmode();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS)
+       /* RTAS panel debug */
+       udbg_init_rtas();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE)
+       /* Maple real mode debug */
+       udbg_init_maple_realmode();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_ISERIES)
+       /* For iSeries - hit Ctrl-x Ctrl-x to see the output */
+       udbg_init_iseries();
+#endif
+}
+
 /* udbg library, used by xmon et al */
 void udbg_puts(const char *s)
 {
index 7541bf44d2da5e95ce7a7cc9a789e7e7db67c817..2da65a9c93f636df3004ee6047a302cabcef09f0 100644 (file)
@@ -155,7 +155,7 @@ void udbg_maple_real_putc(unsigned char c)
        }
 }
 
-void udbg_init_maple_realmode(void)
+void __init udbg_init_maple_realmode(void)
 {
        udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8;
 
diff --git a/arch/powerpc/kernel/vdso32/.gitignore b/arch/powerpc/kernel/vdso32/.gitignore
new file mode 100644 (file)
index 0000000..e45fba9
--- /dev/null
@@ -0,0 +1 @@
+vdso32.lds
diff --git a/arch/powerpc/kernel/vdso64/.gitignore b/arch/powerpc/kernel/vdso64/.gitignore
new file mode 100644 (file)
index 0000000..3fd18cf
--- /dev/null
@@ -0,0 +1 @@
+vdso64.lds
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
new file mode 100644 (file)
index 0000000..b20812d
--- /dev/null
@@ -0,0 +1,26 @@
+menu "Platform support"
+       depends on PPC_83xx
+
+choice
+       prompt "Machine Type"
+       default MPC834x_SYS
+
+config MPC834x_SYS
+       bool "Freescale MPC834x SYS"
+       help
+         This option enables support for the MPC 834x SYS evaluation board.
+
+         Be aware that PCI buses can only function when SYS board is plugged
+         into the PIB (Platform IO Board) board from Freescale which provide
+         3 PCI slots.  The PIBs PCI initialization is the bootloader's
+         responsiblilty.
+
+endchoice
+
+config MPC834x
+       bool
+       select PPC_UDBG_16550
+       select PPC_INDIRECT_PCI
+       default y if MPC834x_SYS
+
+endmenu
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
new file mode 100644 (file)
index 0000000..9d8b28e
--- /dev/null
@@ -0,0 +1,4 @@
+#
+# Makefile for the PowerPC 83xx linux kernel.
+#
+obj-$(CONFIG_MPC834x_SYS)      += mpc834x_sys.o pci.o
index 8836b3a0066837c1c60ccf5ab5e6b1f63b4f38e4..04073fd987ec465d11686ab047ec7456cc24b72a 100644 (file)
@@ -7,6 +7,7 @@ endif
 endif
 obj-$(CONFIG_PPC_CHRP)         += chrp/
 obj-$(CONFIG_4xx)              += 4xx/
+obj-$(CONFIG_PPC_83xx)         += 83xx/
 obj-$(CONFIG_85xx)             += 85xx/
 obj-$(CONFIG_PPC_PSERIES)      += pseries/
 obj-$(CONFIG_PPC_ISERIES)      += iseries/
index de96eadf419d03cdc36ddb830c9ba9402179206b..bdf6c5fe58c02e9346c3334041a668f646687e81 100644 (file)
@@ -86,7 +86,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
        pcpu = get_hard_smp_processor_id(lcpu);
 
        /* Fixup atomic count: it exited inside IRQ handler. */
-       paca[lcpu].__current->thread_info->preempt_count        = 0;
+       task_thread_info(paca[lcpu].__current)->preempt_count   = 0;
 
        /*
         * If the RTAS start-cpu token does not exist then presume the
index 1061c12b2edb5c1d4521ee14205c6281b36676ed..212db28531fabff2185d14c6bf6420c8b642e885 100644 (file)
@@ -169,11 +169,33 @@ static inline void save_mfc_cntl(struct spu_state *csa, struct spu *spu)
        struct spu_priv2 __iomem *priv2 = spu->priv2;
 
        /* Save, Step 8:
-        *     Read and save MFC_CNTL[Ss].
-        */
-       if (csa) {
-               csa->priv2.mfc_control_RW = in_be64(&priv2->mfc_control_RW) &
-                   MFC_CNTL_SUSPEND_DMA_STATUS_MASK;
+        *     Suspend DMA and save MFC_CNTL.
+        */
+       switch (in_be64(&priv2->mfc_control_RW) &
+              MFC_CNTL_SUSPEND_DMA_STATUS_MASK) {
+       case MFC_CNTL_SUSPEND_IN_PROGRESS:
+               POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) &
+                                 MFC_CNTL_SUSPEND_DMA_STATUS_MASK) ==
+                                MFC_CNTL_SUSPEND_COMPLETE);
+               /* fall through */
+       case MFC_CNTL_SUSPEND_COMPLETE:
+               if (csa) {
+                       csa->priv2.mfc_control_RW =
+                               in_be64(&priv2->mfc_control_RW) |
+                               MFC_CNTL_SUSPEND_DMA_QUEUE;
+               }
+               break;
+       case MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION:
+               out_be64(&priv2->mfc_control_RW, MFC_CNTL_SUSPEND_DMA_QUEUE);
+               POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) &
+                                 MFC_CNTL_SUSPEND_DMA_STATUS_MASK) ==
+                                MFC_CNTL_SUSPEND_COMPLETE);
+               if (csa) {
+                       csa->priv2.mfc_control_RW =
+                               in_be64(&priv2->mfc_control_RW) &
+                               ~MFC_CNTL_SUSPEND_DMA_QUEUE;
+               }
+               break;
        }
 }
 
@@ -237,6 +259,8 @@ static inline void save_mfc_decr(struct spu_state *csa, struct spu *spu)
                eieio();
                csa->spu_chnldata_RW[7] = in_be64(&priv2->spu_chnldata_RW);
                eieio();
+       } else {
+               csa->priv2.mfc_control_RW &= ~MFC_CNTL_DECREMENTER_RUNNING;
        }
 }
 
index 81250090f98d39a067f6fe3f0485adfdc70901ae..4fdbc9ae876b495d05edcc906276eaa4a7625d86 100644 (file)
@@ -144,16 +144,6 @@ config LITE5200
          much but it's only been tested on this board version. I think this
          board is also known as IceCube.
 
-config MPC834x_SYS
-       bool "Freescale MPC834x SYS"
-       help
-         This option enables support for the MPC 834x SYS evaluation board.
-
-         Be aware that PCI buses can only function when SYS board is plugged
-         into the PIB (Platform IO Board) board from Freescale which provide
-         3 PCI slots.  The PIBs PCI initialization is the bootloader's
-         responsiblilty.
-
 config EV64360
        bool "Marvell-EV64360BP"
        help
@@ -192,14 +182,6 @@ config 8272
          The MPC8272 CPM has a different internal dpram setup than other CPM2
          devices
 
-config 83xx
-       bool
-       default y if MPC834x_SYS
-
-config MPC834x
-       bool
-       default y if MPC834x_SYS
-
 config CPM2
        bool
        depends on 8260 || MPC8560 || MPC8555
index ad5ef80500ce50d74f9c58b0e97d7a0ff8584782..c6bbe5c25107f2ed2a6452d549a41568d31c8bed 100644 (file)
@@ -52,6 +52,7 @@
 #include <asm/iseries/mf.h>
 #include <asm/iseries/hv_lp_event.h>
 #include <asm/iseries/lpar_map.h>
+#include <asm/udbg.h>
 
 #include "naca.h"
 #include "setup.h"
 #include "call_sm.h"
 #include "call_hpt.h"
 
-extern void hvlog(char *fmt, ...);
-
 #ifdef DEBUG
-#define DBG(fmt...) hvlog(fmt)
+#define DBG(fmt...) udbg_printf(fmt)
 #else
 #define DBG(fmt...)
 #endif
@@ -474,14 +473,6 @@ static unsigned long __init build_iSeries_Memory_Map(void)
        printk("HPT absolute addr = %016lx, size = %dK\n",
                        chunk_to_addr(hptFirstChunk), hptSizeChunks * 256);
 
-       ppc64_pft_size = __ilog2(hptSizePages * HW_PAGE_SIZE);
-
-       /*
-        * The actual hashed page table is in the hypervisor,
-        * we have no direct access
-        */
-       htab_address = NULL;
-
        /*
         * Determine if absolute memory has any
         * holes so that we can interpret the
@@ -861,6 +852,11 @@ void dt_prop_u64_list(struct iseries_flat_dt *dt, char *name, u64 *data, int n)
        dt_prop(dt, name, (char *)data, sizeof(u64) * n);
 }
 
+void dt_prop_u32_list(struct iseries_flat_dt *dt, char *name, u32 *data, int n)
+{
+       dt_prop(dt, name, (char *)data, sizeof(u32) * n);
+}
+
 void dt_prop_empty(struct iseries_flat_dt *dt, char *name)
 {
        dt_prop(dt, name, NULL, 0);
@@ -872,6 +868,7 @@ void dt_cpus(struct iseries_flat_dt *dt)
        unsigned char *p;
        unsigned int i, index;
        struct IoHriProcessorVpd *d;
+       u32 pft_size[2];
 
        /* yuck */
        snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name);
@@ -882,6 +879,9 @@ void dt_cpus(struct iseries_flat_dt *dt)
        dt_prop_u32(dt, "#address-cells", 1);
        dt_prop_u32(dt, "#size-cells", 0);
 
+       pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA  */
+       pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
+
        for (i = 0; i < NR_CPUS; i++) {
                if (paca[i].lppaca.dyn_proc_status >= 2)
                        continue;
@@ -908,6 +908,8 @@ void dt_cpus(struct iseries_flat_dt *dt)
 
                dt_prop_u32(dt, "reg", i);
 
+               dt_prop_u32_list(dt, "ibm,pft-size", pft_size, 2);
+
                dt_end_node(dt);
        }
 
@@ -984,3 +986,16 @@ static int __init early_parsemem(char *p)
        return 0;
 }
 early_param("mem", early_parsemem);
+
+static void hvputc(char c)
+{
+       if (c == '\n')
+               hvputc('\r');
+
+       HvCall_writeLogBuffer(&c, 1);
+}
+
+void __init udbg_init_iseries(void)
+{
+       udbg_putc = hvputc;
+}
index e87d53acfb61827936bb200badbc794f0f569c91..c4352a8db644c48ce0cfab3f2bab271a28ddfece 100644 (file)
@@ -153,7 +153,7 @@ static void udbg_real_scc_putc(char c)
                udbg_real_scc_putc('\r');
 }
 
-void udbg_init_pmac_realmode(void)
+void __init udbg_init_pmac_realmode(void)
 {
        sccc = (volatile u8 __iomem *)0x80013020ul;
        sccd = (volatile u8 __iomem *)0x80013030ul;
index 25181c594d737f128c0f8676a30dad24a328108c..2f543cea97879ac5fc267b1da16171761e1b316c 100644 (file)
@@ -282,7 +282,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
        pcpu = get_hard_smp_processor_id(lcpu);
 
        /* Fixup atomic count: it exited inside IRQ handler. */
-       paca[lcpu].__current->thread_info->preempt_count        = 0;
+       task_thread_info(paca[lcpu].__current)->preempt_count   = 0;
 
        /* 
         * If the RTAS start-cpu token does not exist then presume the
index 14b9abde2d27eaf85fd55b092728bfc7ab7bb467..0ae841347a099d4b1714079ed436993914ad8c59 100644 (file)
@@ -6,4 +6,4 @@ obj-$(CONFIG_BOOKE)             += dcr.o
 obj-$(CONFIG_40x)              += dcr.o
 obj-$(CONFIG_U3_DART)          += dart_iommu.o
 obj-$(CONFIG_MMIO_NVRAM)       += mmio_nvram.o
-obj-$(CONFIG_83xx)             += ipic.o
+obj-$(CONFIG_PPC_83xx)         += ipic.o
index 84d96b857e4af93fdf6055f59ad177f1d6047ae9..ebc4db8fcc63de0380e2dacc99b5feb5a9abe263 100644 (file)
@@ -47,6 +47,7 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/init.h>
+#include <linux/capability.h>
 #include <linux/circ_buf.h>
 #include <linux/serial.h>
 #include <linux/console.h>
index e396f4591d59a3083c1c42f8fdd3ca771b5498a4..d65810108bc35dbdaf2f58a3a0c496baceb087e3 100644 (file)
@@ -743,6 +743,10 @@ config MPC834x
        bool
        default y if MPC834x_SYS
 
+config PPC_83xx
+       bool
+       default y if 83xx
+
 config CPM1
        bool
        depends on 8xx
index 91195e2ce38d138861315f3006f4a9e53e3ef1cf..5f35cf3986f768c186a269bbc0ec048e67cba824 100644 (file)
@@ -96,8 +96,8 @@ void amiga_init_IRQ(void)
                gayle.inten = GAYLE_IRQ_IDE;
 
        /* turn off all interrupts... */
-       custom.intena = 0x7fff;
-       custom.intreq = 0x7fff;
+       amiga_custom.intena = 0x7fff;
+       amiga_custom.intreq = 0x7fff;
 
 #ifdef CONFIG_APUS
        /* Clear any inter-CPU interrupt requests. Circumvents bug in
@@ -110,7 +110,7 @@ void amiga_init_IRQ(void)
        APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_IPLMASK);
 #endif
        /* ... and enable the master interrupt bit */
-       custom.intena = IF_SETCLR | IF_INTEN;
+       amiga_custom.intena = IF_SETCLR | IF_INTEN;
 
        cia_init_IRQ(&ciaa_base);
        cia_init_IRQ(&ciab_base);
@@ -151,7 +151,7 @@ void amiga_enable_irq(unsigned int irq)
        }
 
        /* enable the interrupt */
-       custom.intena = IF_SETCLR | ami_intena_vals[irq];
+       amiga_custom.intena = IF_SETCLR | ami_intena_vals[irq];
 }
 
 void amiga_disable_irq(unsigned int irq)
@@ -177,7 +177,7 @@ void amiga_disable_irq(unsigned int irq)
        }
 
        /* disable the interrupt */
-       custom.intena = ami_intena_vals[irq];
+       amiga_custom.intena = ami_intena_vals[irq];
 }
 
 inline void amiga_do_irq(int irq, struct pt_regs *fp)
@@ -196,7 +196,7 @@ void amiga_do_irq_list(int irq, struct pt_regs *fp)
 
        kstat_cpu(0).irqs[irq]++;
 
-       custom.intreq = ami_intena_vals[irq];
+       amiga_custom.intreq = ami_intena_vals[irq];
 
        for (action = desc->action; action; action = action->next)
                action->handler(irq, action->dev_id, fp);
@@ -208,40 +208,40 @@ void amiga_do_irq_list(int irq, struct pt_regs *fp)
 
 static void ami_int1(int irq, void *dev_id, struct pt_regs *fp)
 {
-       unsigned short ints = custom.intreqr & custom.intenar;
+       unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
 
        /* if serial transmit buffer empty, interrupt */
        if (ints & IF_TBE) {
-               custom.intreq = IF_TBE;
+               amiga_custom.intreq = IF_TBE;
                amiga_do_irq(IRQ_AMIGA_TBE, fp);
        }
 
        /* if floppy disk transfer complete, interrupt */
        if (ints & IF_DSKBLK) {
-               custom.intreq = IF_DSKBLK;
+               amiga_custom.intreq = IF_DSKBLK;
                amiga_do_irq(IRQ_AMIGA_DSKBLK, fp);
        }
 
        /* if software interrupt set, interrupt */
        if (ints & IF_SOFT) {
-               custom.intreq = IF_SOFT;
+               amiga_custom.intreq = IF_SOFT;
                amiga_do_irq(IRQ_AMIGA_SOFT, fp);
        }
 }
 
 static void ami_int3(int irq, void *dev_id, struct pt_regs *fp)
 {
-       unsigned short ints = custom.intreqr & custom.intenar;
+       unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
 
        /* if a blitter interrupt */
        if (ints & IF_BLIT) {
-               custom.intreq = IF_BLIT;
+               amiga_custom.intreq = IF_BLIT;
                amiga_do_irq(IRQ_AMIGA_BLIT, fp);
        }
 
        /* if a copper interrupt */
        if (ints & IF_COPER) {
-               custom.intreq = IF_COPER;
+               amiga_custom.intreq = IF_COPER;
                amiga_do_irq(IRQ_AMIGA_COPPER, fp);
        }
 
@@ -252,36 +252,36 @@ static void ami_int3(int irq, void *dev_id, struct pt_regs *fp)
 
 static void ami_int4(int irq, void *dev_id, struct pt_regs *fp)
 {
-       unsigned short ints = custom.intreqr & custom.intenar;
+       unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
 
        /* if audio 0 interrupt */
        if (ints & IF_AUD0) {
-               custom.intreq = IF_AUD0;
+               amiga_custom.intreq = IF_AUD0;
                amiga_do_irq(IRQ_AMIGA_AUD0, fp);
        }
 
        /* if audio 1 interrupt */
        if (ints & IF_AUD1) {
-               custom.intreq = IF_AUD1;
+               amiga_custom.intreq = IF_AUD1;
                amiga_do_irq(IRQ_AMIGA_AUD1, fp);
        }
 
        /* if audio 2 interrupt */
        if (ints & IF_AUD2) {
-               custom.intreq = IF_AUD2;
+               amiga_custom.intreq = IF_AUD2;
                amiga_do_irq(IRQ_AMIGA_AUD2, fp);
        }
 
        /* if audio 3 interrupt */
        if (ints & IF_AUD3) {
-               custom.intreq = IF_AUD3;
+               amiga_custom.intreq = IF_AUD3;
                amiga_do_irq(IRQ_AMIGA_AUD3, fp);
        }
 }
 
 static void ami_int5(int irq, void *dev_id, struct pt_regs *fp)
 {
-       unsigned short ints = custom.intreqr & custom.intenar;
+       unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
 
        /* if serial receive buffer full interrupt */
        if (ints & IF_RBF) {
@@ -291,7 +291,7 @@ static void ami_int5(int irq, void *dev_id, struct pt_regs *fp)
 
        /* if a disk sync interrupt */
        if (ints & IF_DSKSYN) {
-               custom.intreq = IF_DSKSYN;
+               amiga_custom.intreq = IF_DSKSYN;
                amiga_do_irq(IRQ_AMIGA_DSKSYN, fp);
        }
 }
index ad961465b6cb62fa04afa78910a65c59bb5c5a04..4431c58f611a95764ea2a6ed6f10f125e4014f60 100644 (file)
@@ -66,7 +66,7 @@ static unsigned char cia_set_irq_private(struct ciabase *base,
        else
                base->icr_data &= ~mask;
        if (base->icr_data & base->icr_mask)
-               custom.intreq = IF_SETCLR | base->int_mask;
+               amiga_custom.intreq = IF_SETCLR | base->int_mask;
        return old & base->icr_mask;
 }
 
@@ -114,7 +114,7 @@ static unsigned char cia_able_irq_private(struct ciabase *base,
        base->icr_mask &= CIA_ICR_ALL;
 
        if (base->icr_data & base->icr_mask)
-               custom.intreq = IF_SETCLR | base->int_mask;
+               amiga_custom.intreq = IF_SETCLR | base->int_mask;
        return old;
 }
 
@@ -145,7 +145,7 @@ static void cia_handler(int irq, void *dev_id, struct pt_regs *fp)
        irq = base->cia_irq;
        desc = irq_desc + irq;
        ints = cia_set_irq_private(base, CIA_ICR_ALL);
-       custom.intreq = base->int_mask;
+       amiga_custom.intreq = base->int_mask;
        for (i = 0; i < CIA_IRQS; i++, irq++) {
                if (ints & 1) {
                        kstat_cpu(0).irqs[irq]++;
@@ -174,5 +174,5 @@ void __init cia_init_IRQ(struct ciabase *base)
        action->name = base->name;
        setup_irq(base->handler_irq, &amiga_sys_irqaction[base->handler_irq-IRQ_AMIGA_AUTO]);
 
-       custom.intena = IF_SETCLR | base->int_mask;
+       amiga_custom.intena = IF_SETCLR | base->int_mask;
 }
index af881d7454ddd1254e8e4a4aedbb80d4c6e8cb18..60e2da1c92c07a79f47c387fe75059b7f1d61657 100644 (file)
@@ -90,9 +90,6 @@ static void a3000_gettod (int *, int *, int *, int *, int *, int *);
 static void a2000_gettod (int *, int *, int *, int *, int *, int *);
 static int amiga_hwclk (int, struct hwclk_time *);
 static int amiga_set_clock_mmss (unsigned long);
-#ifdef CONFIG_AMIGA_FLOPPY
-extern void amiga_floppy_setup(char *, int *);
-#endif
 static void amiga_reset (void);
 extern void amiga_init_sound(void);
 static void amiga_savekmsg_init(void);
@@ -281,7 +278,7 @@ static void __init amiga_identify(void)
     case CS_OCS:
     case CS_ECS:
     case CS_AGA:
-      switch (custom.deniseid & 0xf) {
+      switch (amiga_custom.deniseid & 0xf) {
       case 0x0c:
        AMIGAHW_SET(DENISE_HR);
        break;
@@ -294,7 +291,7 @@ static void __init amiga_identify(void)
       AMIGAHW_SET(DENISE);
       break;
     }
-    switch ((custom.vposr>>8) & 0x7f) {
+    switch ((amiga_custom.vposr>>8) & 0x7f) {
     case 0x00:
       AMIGAHW_SET(AGNUS_PAL);
       break;
@@ -419,9 +416,6 @@ void __init config_amiga(void)
 
   mach_hwclk           = amiga_hwclk;
   mach_set_clock_mmss  = amiga_set_clock_mmss;
-#ifdef CONFIG_AMIGA_FLOPPY
-  mach_floppy_setup    = amiga_floppy_setup;
-#endif
   mach_reset           = amiga_reset;
 #ifdef CONFIG_HEARTBEAT
   mach_heartbeat = amiga_heartbeat;
@@ -432,9 +426,9 @@ void __init config_amiga(void)
   amiga_colorclock = 5*amiga_eclock;   /* 3.5 MHz */
 
   /* clear all DMA bits */
-  custom.dmacon = DMAF_ALL;
+  amiga_custom.dmacon = DMAF_ALL;
   /* ensure that the DMA master bit is set */
-  custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
+  amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
 
   /* request all RAM */
   for (i = 0; i < m68k_num_memory; i++) {
@@ -753,9 +747,9 @@ static void amiga_savekmsg_init(void)
 
 static void amiga_serial_putc(char c)
 {
-    custom.serdat = (unsigned char)c | 0x100;
+    amiga_custom.serdat = (unsigned char)c | 0x100;
     mb();
-    while (!(custom.serdatr & 0x2000))
+    while (!(amiga_custom.serdatr & 0x2000))
        ;
 }
 
@@ -785,11 +779,11 @@ int amiga_serial_console_wait_key(struct console *co)
 {
     int ch;
 
-    while (!(custom.intreqr & IF_RBF))
+    while (!(amiga_custom.intreqr & IF_RBF))
        barrier();
-    ch = custom.serdatr & 0xff;
+    ch = amiga_custom.serdatr & 0xff;
     /* clear the interrupt, so that another character can be read */
-    custom.intreq = IF_RBF;
+    amiga_custom.intreq = IF_RBF;
     return ch;
 }
 
index ca810025993f3a9ab882fb46722cd46543b6e85e..2f5c7650274f26a76e7b4f75cba8ed554dccc33e 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
 #include <linux/sysctl.h>
+#include <linux/capability.h>
 #include <linux/ctype.h>
 #include <linux/threads.h>
 #include <linux/smp_lock.h>
index 25cbdc8d2941a9ccd7c2e315889cabf4d2a8c0bd..a76b504299ca09eb801353c8bef99019b563fe81 100644 (file)
@@ -384,7 +384,7 @@ void show_regs(struct pt_regs * regs)
        if (trap == 0x300 || trap == 0x600)
                printk("DAR: %08lX, DSISR: %08lX\n", regs->dar, regs->dsisr);
        printk("TASK = %p[%d] '%s' THREAD: %p\n",
-              current, current->pid, current->comm, current->thread_info);
+              current, current->pid, current->comm, task_thread_info(current));
        printk("Last syscall: %ld ", current->thread.last_syscall);
 
 #ifdef CONFIG_SMP
@@ -482,7 +482,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 {
        struct pt_regs *childregs, *kregs;
        extern void ret_from_fork(void);
-       unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
+       unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
        unsigned long childframe;
 
        CHECK_FULL_REGS(regs);
@@ -702,8 +702,8 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
                        sp = tsk->thread.ksp;
        }
 
-       prev_sp = (unsigned long) (tsk->thread_info + 1);
-       stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
+       prev_sp = (unsigned long) end_of_stack(tsk);
+       stack_top = (unsigned long) task_stack_page(tsk) + THREAD_SIZE;
        while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) {
                if (count == 0) {
                        printk("Call trace:");
@@ -832,7 +832,7 @@ void __init ll_puts(const char *s)
 unsigned long get_wchan(struct task_struct *p)
 {
        unsigned long ip, sp;
-       unsigned long stack_page = (unsigned long) p->thread_info;
+       unsigned long stack_page = (unsigned long) task_stack_page(p);
        int count = 0;
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;
index becbfa397556a378c87aea3c05e8418073072fb4..e55cdda6149a1f1e189012a1b79c542477a008a9 100644 (file)
@@ -318,7 +318,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
                p = fork_idle(cpu);
                if (IS_ERR(p))
                        panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
-               p->thread_info->cpu = cpu;
+               task_thread_info(p)->cpu = cpu;
                idle_tasks[cpu] = p;
        }
 }
@@ -369,7 +369,7 @@ int __cpu_up(unsigned int cpu)
        char buf[32];
        int c;
 
-       secondary_ti = idle_tasks[cpu]->thread_info;
+       secondary_ti = task_thread_info(idle_tasks[cpu]);
        mb();
 
        /*
index 2f74fde98ebc68276aacd92f507bbe9ca7362808..c42c50073da54a6e621b16da9a57353299d10d66 100644 (file)
@@ -55,9 +55,6 @@ int (*mach_hwclk) (int, struct hwclk_time*) = NULL;
 int (*mach_set_clock_mmss) (unsigned long) = NULL;
 void (*mach_reset)( void );
 long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
-#if defined(CONFIG_AMIGA_FLOPPY)
-void (*mach_floppy_setup) (char *, int *) __initdata = NULL;
-#endif
 #ifdef CONFIG_HEARTBEAT
 void (*mach_heartbeat) (int) = NULL;
 extern void apus_heartbeat (void);
@@ -76,7 +73,6 @@ struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
 
 struct mem_info ramdisk;
 
-extern void amiga_floppy_setup(char *, int *);
 extern void config_amiga(void);
 
 static int __60nsram = 0;
@@ -305,16 +301,6 @@ void kbd_reset_setup(char *str, int *ints)
 {
 }
 
-/*********************************************************** FLOPPY */
-#if defined(CONFIG_AMIGA_FLOPPY)
-__init
-void floppy_setup(char *str, int *ints)
-{
-       if (mach_floppy_setup)
-               mach_floppy_setup (str, ints);
-}
-#endif
-
 /*********************************************************** MEMORY */
 #define KMAP_MAX 32
 unsigned long kmap_chunks[KMAP_MAX*3];
@@ -574,9 +560,9 @@ static __inline__ void ser_RTSon(void)
 
 int __debug_ser_out( unsigned char c )
 {
-       custom.serdat = c | 0x100;
+       amiga_custom.serdat = c | 0x100;
        mb();
-       while (!(custom.serdatr & 0x2000))
+       while (!(amiga_custom.serdatr & 0x2000))
                barrier();
        return 1;
 }
@@ -586,11 +572,11 @@ unsigned char __debug_ser_in( void )
        unsigned char c;
 
        /* XXX: is that ok?? derived from amiga_ser.c... */
-       while( !(custom.intreqr & IF_RBF) )
+       while( !(amiga_custom.intreqr & IF_RBF) )
                barrier();
-       c = custom.serdatr;
+       c = amiga_custom.serdatr;
        /* clear the interrupt, so that another character can be read */
-       custom.intreq = IF_RBF;
+       amiga_custom.intreq = IF_RBF;
        return c;
 }
 
@@ -601,10 +587,10 @@ int __debug_serinit( void )
        local_irq_save(flags);
 
        /* turn off Rx and Tx interrupts */
-       custom.intena = IF_RBF | IF_TBE;
+       amiga_custom.intena = IF_RBF | IF_TBE;
 
        /* clear any pending interrupt */
-       custom.intreq = IF_RBF | IF_TBE;
+       amiga_custom.intreq = IF_RBF | IF_TBE;
 
        local_irq_restore(flags);
 
@@ -617,7 +603,7 @@ int __debug_serinit( void )
 
 #ifdef CONFIG_KGDB
        /* turn Rx interrupts on for GDB */
-       custom.intena = IF_SETCLR | IF_RBF;
+       amiga_custom.intena = IF_SETCLR | IF_RBF;
        ser_RTSon();
 #endif
 
index 2b483b4f1602b12a73d2b60ba55fea20faa53e31..9075a7538e26410d83bb33a50f822816b26e76bb 100644 (file)
@@ -99,7 +99,7 @@ static void remove_bpts(void);
 static void insert_bpts(void);
 static struct bpt *at_breakpoint(unsigned pc);
 static void bpt_cmds(void);
-static void cacheflush(void);
+void cacheflush(void);
 #ifdef CONFIG_SMP
 static void cpu_cmd(void);
 #endif /* CONFIG_SMP */
index 03ba5893f17b7fcef06b9112f524da8bc8382552..1f451c2cb071896f7032e990ac78256769a74c58 100644 (file)
@@ -112,7 +112,7 @@ static inline int dump_regs32(struct pt_regs *ptregs, elf_gregset_t *regs)
 
 static inline int dump_task_regs32(struct task_struct *tsk, elf_gregset_t *regs)
 {
-       struct pt_regs *ptregs = __KSTK_PTREGS(tsk);
+       struct pt_regs *ptregs = task_pt_regs(tsk);
        int i;
 
        memcpy(&regs->psw.mask, &ptregs->psw.mask, 4);
index cd3b3c3e7a9fe9438c423db548214337d01206af..bf9a7a361b3490b892a40aea7c78edb083a0d12c 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/syscalls.h>
 #include <linux/sysctl.h>
 #include <linux/binfmts.h>
+#include <linux/capability.h>
 #include <linux/compat.h>
 #include <linux/vfs.h>
 #include <linux/ptrace.h>
index 7dd58f8ac6b59848cec44f18fb5931b6d6ee2a47..2ff90a1a105657afc6586fa86c5689843db66fdc 100644 (file)
@@ -153,7 +153,7 @@ void show_regs(struct pt_regs *regs)
 {
        struct task_struct *tsk = current;
 
-        printk("CPU:    %d    %s\n", tsk->thread_info->cpu, print_tainted());
+        printk("CPU:    %d    %s\n", task_thread_info(tsk)->cpu, print_tainted());
         printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
               current->comm, current->pid, (void *) tsk,
               (void *) tsk->thread.ksp);
@@ -217,8 +217,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
             struct pt_regs childregs;
           } *frame;
 
-        frame = ((struct fake_frame *)
-                (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
+        frame = container_of(task_pt_regs(p), struct fake_frame, childregs);
         p->thread.ksp = (unsigned long) frame;
        /* Store access registers to kernel stack of new process. */
         frame->childregs = *regs;
@@ -358,11 +357,10 @@ unsigned long get_wchan(struct task_struct *p)
        unsigned long return_address;
        int count;
 
-       if (!p || p == current || p->state == TASK_RUNNING || !p->thread_info)
+       if (!p || p == current || p->state == TASK_RUNNING || !task_stack_page(p))
                return 0;
-       low = (struct stack_frame *) p->thread_info;
-       high = (struct stack_frame *)
-               ((unsigned long) p->thread_info + THREAD_SIZE) - 1;
+       low = task_stack_page(p);
+       high = (struct stack_frame *) task_pt_regs(p);
        sf = (struct stack_frame *) (p->thread.ksp & PSW_ADDR_INSN);
        if (sf <= low || sf > high)
                return 0;
index cc02232aa96e93be846ceac801908fc08e070432..37dfe33dab735986e3eb781028884ac1e5c65816 100644 (file)
@@ -52,7 +52,7 @@ FixPerRegisters(struct task_struct *task)
        struct pt_regs *regs;
        per_struct *per_info;
 
-       regs = __KSTK_PTREGS(task);
+       regs = task_pt_regs(task);
        per_info = (per_struct *) &task->thread.per_info;
        per_info->control_regs.bits.em_instruction_fetch =
                per_info->single_step | per_info->instruction_fetch;
@@ -150,7 +150,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)->psw + addr);
+               tmp = *(addr_t *)((addr_t) &task_pt_regs(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)
                /*
                 * orig_gpr2 is stored on the kernel stack
                 */
-               tmp = (addr_t) __KSTK_PTREGS(child)->orig_gpr2;
+               tmp = (addr_t) task_pt_regs(child)->orig_gpr2;
 
        } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
                /* 
@@ -243,7 +243,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)->psw + addr) = data;
+               *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;
 
        } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {
                /*
@@ -267,7 +267,7 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
                /*
                 * orig_gpr2 is stored on the kernel stack
                 */
-               __KSTK_PTREGS(child)->orig_gpr2 = data;
+               task_pt_regs(child)->orig_gpr2 = data;
 
        } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
                /*
@@ -393,15 +393,15 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
                 */
                if (addr == (addr_t) &dummy32->regs.psw.mask) {
                        /* Fake a 31 bit psw mask. */
-                       tmp = (__u32)(__KSTK_PTREGS(child)->psw.mask >> 32);
+                       tmp = (__u32)(task_pt_regs(child)->psw.mask >> 32);
                        tmp = PSW32_MASK_MERGE(PSW32_USER_BITS, tmp);
                } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
                        /* Fake a 31 bit psw address. */
-                       tmp = (__u32) __KSTK_PTREGS(child)->psw.addr |
+                       tmp = (__u32) task_pt_regs(child)->psw.addr |
                                PSW32_ADDR_AMODE31;
                } else {
                        /* gpr 0-15 */
-                       tmp = *(__u32 *)((addr_t) &__KSTK_PTREGS(child)->psw +
+                       tmp = *(__u32 *)((addr_t) &task_pt_regs(child)->psw +
                                         addr*2 + 4);
                }
        } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {
@@ -415,7 +415,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
                /*
                 * orig_gpr2 is stored on the kernel stack
                 */
-               tmp = *(__u32*)((addr_t) &__KSTK_PTREGS(child)->orig_gpr2 + 4);
+               tmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4);
 
        } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
                /*
@@ -472,15 +472,15 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
                        if (tmp != PSW32_MASK_MERGE(PSW32_USER_BITS, tmp))
                                /* Invalid psw mask. */
                                return -EINVAL;
-                       __KSTK_PTREGS(child)->psw.mask =
+                       task_pt_regs(child)->psw.mask =
                                PSW_MASK_MERGE(PSW_USER32_BITS, (__u64) tmp << 32);
                } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
                        /* Build a 64 bit psw address from 31 bit address. */
-                       __KSTK_PTREGS(child)->psw.addr = 
+                       task_pt_regs(child)->psw.addr =
                                (__u64) tmp & PSW32_ADDR_INSN;
                } else {
                        /* gpr 0-15 */
-                       *(__u32*)((addr_t) &__KSTK_PTREGS(child)->psw
+                       *(__u32*)((addr_t) &task_pt_regs(child)->psw
                                  + addr*2 + 4) = tmp;
                }
        } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {
@@ -494,7 +494,7 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
                /*
                 * orig_gpr2 is stored on the kernel stack
                 */
-               *(__u32*)((addr_t) &__KSTK_PTREGS(child)->orig_gpr2 + 4) = tmp;
+               *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4) = tmp;
 
        } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
                /*
index e10f4ca00499ede1690e0a650ee935a5b7f27c12..cbfcfd02a43a503447380c55f5ab852d248e545b 100644 (file)
@@ -657,7 +657,7 @@ __cpu_up(unsigned int cpu)
        idle = current_set[cpu];
         cpu_lowcore = lowcore_ptr[cpu];
        cpu_lowcore->kernel_stack = (unsigned long)
-               idle->thread_info + (THREAD_SIZE);
+               task_stack_page(idle) + (THREAD_SIZE);
        sf = (struct stack_frame *) (cpu_lowcore->kernel_stack
                                     - sizeof(struct pt_regs)
                                     - sizeof(struct stack_frame));
index c36353e8c1404b22ae5dfbd8f0b0bd8f1a8214b8..b0d8ca8e5eebd7917a87b88ebfae98a258fa0cc4 100644 (file)
@@ -282,7 +282,7 @@ static inline void start_hz_timer(void)
 {
        if (!cpu_isset(smp_processor_id(), nohz_cpu_mask))
                return;
-       account_ticks(__KSTK_PTREGS(current));
+       account_ticks(task_pt_regs(current));
        cpu_clear(smp_processor_id(), nohz_cpu_mask);
 }
 
index 95d1099686198e8deb030b027722e832a990c1e3..5d21e9e6e7b4505fc6647aaa039222a44197de85 100644 (file)
@@ -136,8 +136,8 @@ void show_trace(struct task_struct *task, unsigned long * stack)
        sp = __show_trace(sp, S390_lowcore.async_stack - ASYNC_SIZE,
                          S390_lowcore.async_stack);
        if (task)
-               __show_trace(sp, (unsigned long) task->thread_info,
-                            (unsigned long) task->thread_info + THREAD_SIZE);
+               __show_trace(sp, (unsigned long) task_stack_page(task),
+                            (unsigned long) task_stack_page(task) + THREAD_SIZE);
        else
                __show_trace(sp, S390_lowcore.thread_info,
                             S390_lowcore.thread_info + THREAD_SIZE);
@@ -240,7 +240,7 @@ char *task_show_regs(struct task_struct *task, char *buffer)
 {
        struct pt_regs *regs;
 
-       regs = __KSTK_PTREGS(task);
+       regs = task_pt_regs(task);
        buffer += sprintf(buffer, "task: %p, ksp: %p\n",
                       task, (void *)task->thread.ksp);
        buffer += sprintf(buffer, "User PSW : %p %p\n",
index 8a2bea34ddd2635ca344ea564385483c9919c59d..aac15e42d03bbe7300276c774cf9af20c8fb37b1 100644 (file)
@@ -191,13 +191,8 @@ void flush_thread(void)
 {
 #if defined(CONFIG_SH_FPU)
        struct task_struct *tsk = current;
-       struct pt_regs *regs = (struct pt_regs *)
-                               ((unsigned long)tsk->thread_info
-                                + THREAD_SIZE - sizeof(struct pt_regs)
-                                - sizeof(unsigned long));
-
        /* Forget lazy FPU state */
-       clear_fpu(tsk, regs);
+       clear_fpu(tsk, task_pt_regs(tsk));
        clear_used_math();
 #endif
 }
@@ -232,13 +227,7 @@ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
 {
        struct pt_regs ptregs;
        
-       ptregs = *(struct pt_regs *)
-               ((unsigned long)tsk->thread_info + THREAD_SIZE
-                - sizeof(struct pt_regs)
-#ifdef CONFIG_SH_DSP
-                - sizeof(struct pt_dspregs)
-#endif
-                - sizeof(unsigned long));
+       ptregs = *task_pt_regs(tsk);
        elf_core_copy_regs(regs, &ptregs);
 
        return 1;
@@ -252,11 +241,7 @@ dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *fpu)
 #if defined(CONFIG_SH_FPU)
        fpvalid = !!tsk_used_math(tsk);
        if (fpvalid) {
-               struct pt_regs *regs = (struct pt_regs *)
-                                       ((unsigned long)tsk->thread_info
-                                        + THREAD_SIZE - sizeof(struct pt_regs)
-                                        - sizeof(unsigned long));
-               unlazy_fpu(tsk, regs);
+               unlazy_fpu(tsk, task_pt_regs(tsk));
                memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu));
        }
 #endif
@@ -279,18 +264,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
        copy_to_stopped_child_used_math(p);
 #endif
 
-       childregs = ((struct pt_regs *)
-               (THREAD_SIZE + (unsigned long) p->thread_info)
-#ifdef CONFIG_SH_DSP
-               - sizeof(struct pt_dspregs)
-#endif
-               - sizeof(unsigned long)) - 1;
+       childregs = task_pt_regs(p);
        *childregs = *regs;
 
        if (user_mode(regs)) {
                childregs->regs[15] = usp;
        } else {
-               childregs->regs[15] = (unsigned long)p->thread_info + THREAD_SIZE;
+               childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE;
        }
         if (clone_flags & CLONE_SETTLS) {
                childregs->gbr = childregs->regs[0];
@@ -333,11 +313,7 @@ ubc_set_tracing(int asid, unsigned long pc)
 struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next)
 {
 #if defined(CONFIG_SH_FPU)
-       struct pt_regs *regs = (struct pt_regs *)
-                               ((unsigned long)prev->thread_info
-                                + THREAD_SIZE - sizeof(struct pt_regs)
-                                - sizeof(unsigned long));
-       unlazy_fpu(prev, regs);
+       unlazy_fpu(prev, task_pt_regs(prev));
 #endif
 
 #ifdef CONFIG_PREEMPT
@@ -346,13 +322,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
                struct pt_regs *regs;
 
                local_irq_save(flags);
-               regs = (struct pt_regs *)
-                       ((unsigned long)prev->thread_info
-                        + THREAD_SIZE - sizeof(struct pt_regs)
-#ifdef CONFIG_SH_DSP
-                        - sizeof(struct pt_dspregs)
-#endif
-                        - sizeof(unsigned long));
+               regs = task_pt_regs(prev);
                if (user_mode(regs) && regs->regs[15] >= 0xc0000000) {
                        int offset = (int)regs->regs[15];
 
@@ -372,7 +342,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
         */
        asm volatile("ldc       %0, r7_bank"
                     : /* no output */
-                    : "r" (next->thread_info));
+                    : "r" (task_thread_info(next)));
 
 #ifdef CONFIG_MMU
        /* If no tasks are using the UBC, we're done */
index 1a8be06519ecf4c5de4fc7bcd5ed8dc56bad069b..3887b4f6feb26778cb7bc9fc1962993835356ea5 100644 (file)
@@ -41,12 +41,7 @@ static inline int get_stack_long(struct task_struct *task, int offset)
 {
        unsigned char *stack;
 
-       stack = (unsigned char *)
-               task->thread_info + THREAD_SIZE - sizeof(struct pt_regs)
-#ifdef CONFIG_SH_DSP
-               - sizeof(struct pt_dspregs)
-#endif
-               - sizeof(unsigned long);
+       stack = (unsigned char *)task_pt_regs(task);
        stack += offset;
        return (*((int *)stack));
 }
@@ -59,12 +54,7 @@ static inline int put_stack_long(struct task_struct *task, int offset,
 {
        unsigned char *stack;
 
-       stack = (unsigned char *)
-               task->thread_info + THREAD_SIZE - sizeof(struct pt_regs)
-#ifdef CONFIG_SH_DSP
-               - sizeof(struct pt_dspregs)
-#endif
-               - sizeof(unsigned long);
+       stack = (unsigned char *)task_pt_regs(task);
        stack += offset;
        *(unsigned long *) stack = data;
        return 0;
index 59e49b18252c47ff49e3b4790c0c0a7ab8a9a883..62c7d1c0ad7bd2a0f1070c731e5f63a4156e8384 100644 (file)
@@ -103,7 +103,7 @@ int __cpu_up(unsigned int cpu)
        if (IS_ERR(tsk))
                panic("Failed forking idle task for cpu %d\n", cpu);
        
-       tsk->thread_info->cpu = cpu;
+       task_thread_info(tsk)->cpu = cpu;
 
        cpu_set(cpu, cpu_online_map);
 
index 419b5a71044116c9f6d4d5a396be7e42263286c5..1da9c61d6823558b6d63c0cf82340102dc540a23 100644 (file)
@@ -744,7 +744,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
        }
 #endif
        /* Copy from sh version */
-       childregs = ((struct pt_regs *)(THREAD_SIZE + (unsigned long) p->thread_info )) - 1;
+       childregs = (struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1;
 
        *childregs = *regs;
 
@@ -752,7 +752,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
                childregs->regs[15] = usp;
                p->thread.uregs = childregs;
        } else {
-               childregs->regs[15] = (unsigned long)p->thread_info + THREAD_SIZE;
+               childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE;
        }
 
        childregs->regs[9] = 0; /* Set return value for child */
index 526fedae6db878e7d1cf19861a157cc62b388952..58087331b8a6acd3da88e41f8cb7912635258d64 100644 (file)
@@ -174,7 +174,7 @@ void evt_debug(int evt, int ret_addr, int event, int tra, struct pt_regs *regs)
        struct ring_node *rr;
 
        pid = current->pid;
-       stack_bottom = (unsigned long) current->thread_info;
+       stack_bottom = (unsigned long) task_stack_page(current);
        asm volatile("ori r15, 0, %0" : "=r" (sp));
        rr = event_ring + event_ptr;
        rr->evt = evt;
index ea86474114627f267d739def93a6c33d2b4c9c4d..fbb05a452e51552590e01d7da2e1af7c617d8a47 100644 (file)
@@ -302,7 +302,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
        int count = 0;
 
        if (tsk != NULL)
-               task_base = (unsigned long) tsk->thread_info;
+               task_base = (unsigned long) task_stack_page(tsk);
        else
                task_base = (unsigned long) current_thread_info();
 
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(dump_stack);
  */
 unsigned long thread_saved_pc(struct task_struct *tsk)
 {
-       return tsk->thread_info->kpc;
+       return task_thread_info(tsk)->kpc;
 }
 
 /*
@@ -392,7 +392,7 @@ void flush_thread(void)
                /* We must fixup kregs as well. */
                /* XXX This was not fixed for ti for a while, worked. Unused? */
                current->thread.kregs = (struct pt_regs *)
-                   ((char *)current->thread_info + (THREAD_SIZE - TRACEREG_SZ));
+                   (task_stack_page(current) + (THREAD_SIZE - TRACEREG_SZ));
        }
 }
 
@@ -459,7 +459,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
                unsigned long unused,
                struct task_struct *p, struct pt_regs *regs)
 {
-       struct thread_info *ti = p->thread_info;
+       struct thread_info *ti = task_thread_info(p);
        struct pt_regs *childregs;
        char *new_stack;
 
@@ -482,7 +482,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
         *  V                      V (stk.fr.) V  (pt_regs)  { (stk.fr.) }
         *  +----- - - - - - ------+===========+============={+==========}+
         */
-       new_stack = (char*)ti + THREAD_SIZE;
+       new_stack = task_stack_page(p) + THREAD_SIZE;
        if (regs->psr & PSR_PS)
                new_stack -= STACKFRAME_SZ;
        new_stack -= STACKFRAME_SZ + TRACEREG_SZ;
@@ -724,7 +724,7 @@ unsigned long get_wchan(struct task_struct *task)
             task->state == TASK_RUNNING)
                goto out;
 
-       fp = task->thread_info->ksp + bias;
+       fp = task_thread_info(task)->ksp + bias;
        do {
                /* Bogus frame pointer? */
                if (fp < (task_base + sizeof(struct thread_info)) ||
index fc470c0e9dc6bd453ce6b14143610d70225622d5..1baf13ed5c3a6b6e7186c022e69108ec6d490c46 100644 (file)
@@ -75,7 +75,7 @@ static inline void read_sunos_user(struct pt_regs *regs, unsigned long offset,
                                   struct task_struct *tsk, long __user *addr)
 {
        struct pt_regs *cregs = tsk->thread.kregs;
-       struct thread_info *t = tsk->thread_info;
+       struct thread_info *t = task_thread_info(tsk);
        int v;
        
        if(offset >= 1024)
@@ -170,7 +170,7 @@ static inline void write_sunos_user(struct pt_regs *regs, unsigned long offset,
                                    struct task_struct *tsk)
 {
        struct pt_regs *cregs = tsk->thread.kregs;
-       struct thread_info *t = tsk->thread_info;
+       struct thread_info *t = task_thread_info(tsk);
        unsigned long value = regs->u_regs[UREG_I3];
 
        if(offset >= 1024)
index cc1fc898495c899b4d39a66be014db5dce428191..40d426cce8244f16969e3a12f876855f0893bd0f 100644 (file)
@@ -200,7 +200,7 @@ void __init smp4d_boot_cpus(void)
                        /* Cook up an idler for this guy. */
                        p = fork_idle(i);
                        cpucount++;
-                       current_set[i] = p->thread_info;
+                       current_set[i] = task_thread_info(p);
                        for (no = 0; !cpu_find_by_instance(no, NULL, &mid)
                                     && mid != i; no++) ;
 
index f113422a372761dabce56f5624f0b2835c9e4a08..a21f27d10e55737881f81522262b4e07751476e9 100644 (file)
@@ -173,7 +173,7 @@ void __init smp4m_boot_cpus(void)
                        /* Cook up an idler for this guy. */
                        p = fork_idle(i);
                        cpucount++;
-                       current_set[i] = p->thread_info;
+                       current_set[i] = task_thread_info(p);
                        /* See trampoline.S for details... */
                        entry += ((i-1) * 3);
 
index d07ae02101add23f16aae1209d4a569ce9edb3e2..288de276d9ffd49c7e54bb511c7106a3414fc4c8 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/stat.h>
 #include <linux/slab.h>
 #include <linux/pagemap.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
index 3f451ae664826b827ecd36027d543df74399fa1f..41d45c298fb2426d64a5b293857a4706d880a461 100644 (file)
@@ -291,7 +291,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
 #ifndef CONFIG_SMP
        if(!fpt) {
 #else
-        if(!(fpt->thread_info->flags & _TIF_USEDFPU)) {
+        if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
 #endif
                fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
                regs->psr &= ~PSR_EF;
@@ -334,7 +334,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
        /* nope, better SIGFPE the offending process... */
               
 #ifdef CONFIG_SMP
-       fpt->thread_info->flags &= ~_TIF_USEDFPU;
+       task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
 #endif
        if(psr & PSR_PS) {
                /* The first fsr store/load we tried trapped,
index b775ceb4cf989e38ad2f186cc05566e331c4752b..ab733be9af085cb00b2035f941fbfc9e1fd8ae5b 100644 (file)
@@ -179,7 +179,7 @@ config HUGETLB_PAGE_SIZE_512K
        bool "512K"
 
 config HUGETLB_PAGE_SIZE_64K
-       depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512K
+       depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512KB
        bool "64K"
 
 endchoice
index ff5e9d5cad50ed7f2507f3c9a1935e518d34d937..b9a9ce70e55c1f281ff4759b47abc6d03e10ae49 100644 (file)
@@ -135,6 +135,14 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
                        prepare_singlestep(p, regs, kcb);
                        return 1;
                } else {
+                       if (*(u32 *)addr != BREAKPOINT_INSTRUCTION) {
+                       /* The breakpoint instruction was removed by
+                        * another cpu right after we hit, no further
+                        * handling of this interrupt is appropriate
+                        */
+                               ret = 1;
+                               goto no_kprobe;
+                       }
                        p = __get_cpu_var(current_kprobe);
                        if (p->break_handler && p->break_handler(p, regs))
                                goto ss_probe;
index 02f9dec1d459d79731a8d32658db102940cce2cc..1dc3650c5caefaee73a69e9b68b1cf9705f6af03 100644 (file)
@@ -390,7 +390,7 @@ void show_regs32(struct pt_regs32 *regs)
 
 unsigned long thread_saved_pc(struct task_struct *tsk)
 {
-       struct thread_info *ti = tsk->thread_info;
+       struct thread_info *ti = task_thread_info(tsk);
        unsigned long ret = 0xdeadbeefUL;
        
        if (ti && ti->ksp) {
@@ -616,11 +616,11 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
                unsigned long unused,
                struct task_struct *p, struct pt_regs *regs)
 {
-       struct thread_info *t = p->thread_info;
+       struct thread_info *t = task_thread_info(p);
        char *child_trap_frame;
 
        /* Calculate offset to stack_frame & pt_regs */
-       child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ));
+       child_trap_frame = task_stack_page(p) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ));
        memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ));
 
        t->flags = (t->flags & ~((0xffUL << TI_FLAG_CWP_SHIFT) | (0xffUL << TI_FLAG_CURRENT_DS_SHIFT))) |
@@ -845,9 +845,9 @@ unsigned long get_wchan(struct task_struct *task)
             task->state == TASK_RUNNING)
                goto out;
 
-       thread_info_base = (unsigned long) task->thread_info;
+       thread_info_base = (unsigned long) task_stack_page(task);
        bias = STACK_BIAS;
-       fp = task->thread_info->ksp + bias;
+       fp = task_thread_info(task)->ksp + bias;
 
        do {
                /* Bogus frame pointer? */
index 84d3df2264cb7148e4a5390f05a0ce0baf618844..3f9746f856d28caede6522bbc8a161be74a684a2 100644 (file)
@@ -296,7 +296,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
        case PTRACE_GETREGS: {
                struct pt_regs32 __user *pregs =
                        (struct pt_regs32 __user *) addr;
-               struct pt_regs *cregs = child->thread_info->kregs;
+               struct pt_regs *cregs = task_pt_regs(child);
                int rval;
 
                if (__put_user(tstate_to_psr(cregs->tstate), (&pregs->psr)) ||
@@ -320,11 +320,11 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
 
        case PTRACE_GETREGS64: {
                struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
-               struct pt_regs *cregs = child->thread_info->kregs;
+               struct pt_regs *cregs = task_pt_regs(child);
                unsigned long tpc = cregs->tpc;
                int rval;
 
-               if ((child->thread_info->flags & _TIF_32BIT) != 0)
+               if ((task_thread_info(child)->flags & _TIF_32BIT) != 0)
                        tpc &= 0xffffffff;
                if (__put_user(cregs->tstate, (&pregs->tstate)) ||
                    __put_user(tpc, (&pregs->tpc)) ||
@@ -348,7 +348,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
        case PTRACE_SETREGS: {
                struct pt_regs32 __user *pregs =
                        (struct pt_regs32 __user *) addr;
-               struct pt_regs *cregs = child->thread_info->kregs;
+               struct pt_regs *cregs = task_pt_regs(child);
                unsigned int psr, pc, npc, y;
                int i;
 
@@ -381,7 +381,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
 
        case PTRACE_SETREGS64: {
                struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
-               struct pt_regs *cregs = child->thread_info->kregs;
+               struct pt_regs *cregs = task_pt_regs(child);
                unsigned long tstate, tpc, tnpc, y;
                int i;
 
@@ -395,7 +395,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
                        pt_error_return(regs, EFAULT);
                        goto out_tsk;
                }
-               if ((child->thread_info->flags & _TIF_32BIT) != 0) {
+               if ((task_thread_info(child)->flags & _TIF_32BIT) != 0) {
                        tpc &= 0xffffffff;
                        tnpc &= 0xffffffff;
                }
@@ -430,11 +430,11 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
                        } fpq[16];
                };
                struct fps __user *fps = (struct fps __user *) addr;
-               unsigned long *fpregs = child->thread_info->fpregs;
+               unsigned long *fpregs = task_thread_info(child)->fpregs;
 
                if (copy_to_user(&fps->regs[0], fpregs,
                                 (32 * sizeof(unsigned int))) ||
-                   __put_user(child->thread_info->xfsr[0], (&fps->fsr)) ||
+                   __put_user(task_thread_info(child)->xfsr[0], (&fps->fsr)) ||
                    __put_user(0, (&fps->fpqd)) ||
                    __put_user(0, (&fps->flags)) ||
                    __put_user(0, (&fps->extra)) ||
@@ -452,11 +452,11 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
                        unsigned long fsr;
                };
                struct fps __user *fps = (struct fps __user *) addr;
-               unsigned long *fpregs = child->thread_info->fpregs;
+               unsigned long *fpregs = task_thread_info(child)->fpregs;
 
                if (copy_to_user(&fps->regs[0], fpregs,
                                 (64 * sizeof(unsigned int))) ||
-                   __put_user(child->thread_info->xfsr[0], (&fps->fsr))) {
+                   __put_user(task_thread_info(child)->xfsr[0], (&fps->fsr))) {
                        pt_error_return(regs, EFAULT);
                        goto out_tsk;
                }
@@ -477,7 +477,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
                        } fpq[16];
                };
                struct fps __user *fps = (struct fps __user *) addr;
-               unsigned long *fpregs = child->thread_info->fpregs;
+               unsigned long *fpregs = task_thread_info(child)->fpregs;
                unsigned fsr;
 
                if (copy_from_user(fpregs, &fps->regs[0],
@@ -486,11 +486,11 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
                        pt_error_return(regs, EFAULT);
                        goto out_tsk;
                }
-               child->thread_info->xfsr[0] &= 0xffffffff00000000UL;
-               child->thread_info->xfsr[0] |= fsr;
-               if (!(child->thread_info->fpsaved[0] & FPRS_FEF))
-                       child->thread_info->gsr[0] = 0;
-               child->thread_info->fpsaved[0] |= (FPRS_FEF | FPRS_DL);
+               task_thread_info(child)->xfsr[0] &= 0xffffffff00000000UL;
+               task_thread_info(child)->xfsr[0] |= fsr;
+               if (!(task_thread_info(child)->fpsaved[0] & FPRS_FEF))
+                       task_thread_info(child)->gsr[0] = 0;
+               task_thread_info(child)->fpsaved[0] |= (FPRS_FEF | FPRS_DL);
                pt_succ_return(regs, 0);
                goto out_tsk;
        }
@@ -501,17 +501,17 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
                        unsigned long fsr;
                };
                struct fps __user *fps = (struct fps __user *) addr;
-               unsigned long *fpregs = child->thread_info->fpregs;
+               unsigned long *fpregs = task_thread_info(child)->fpregs;
 
                if (copy_from_user(fpregs, &fps->regs[0],
                                   (64 * sizeof(unsigned int))) ||
-                   __get_user(child->thread_info->xfsr[0], (&fps->fsr))) {
+                   __get_user(task_thread_info(child)->xfsr[0], (&fps->fsr))) {
                        pt_error_return(regs, EFAULT);
                        goto out_tsk;
                }
-               if (!(child->thread_info->fpsaved[0] & FPRS_FEF))
-                       child->thread_info->gsr[0] = 0;
-               child->thread_info->fpsaved[0] |= (FPRS_FEF | FPRS_DL | FPRS_DU);
+               if (!(task_thread_info(child)->fpsaved[0] & FPRS_FEF))
+                       task_thread_info(child)->gsr[0] = 0;
+               task_thread_info(child)->fpsaved[0] |= (FPRS_FEF | FPRS_DL | FPRS_DU);
                pt_succ_return(regs, 0);
                goto out_tsk;
        }
@@ -562,8 +562,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
 #ifdef DEBUG_PTRACE
                printk("CONT: %s [%d]: set exit_code = %x %lx %lx\n", child->comm,
                        child->pid, child->exit_code,
-                       child->thread_info->kregs->tpc,
-                       child->thread_info->kregs->tnpc);
+                       task_pt_regs(child)->tpc,
+                       task_pt_regs(child)->tnpc);
                       
 #endif
                wake_up_process(child);
index 48180531562fbdd4d21559986fb4b81ef4862dc7..250745896aeec4959087f544e8e46914bd6d2fdd 100644 (file)
@@ -520,7 +520,7 @@ void __init setup_arch(char **cmdline_p)
        rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0);     
 #endif
 
-       init_task.thread_info->kregs = &fake_swapper_regs;
+       task_thread_info(&init_task)->kregs = &fake_swapper_regs;
 
 #ifdef CONFIG_IP_PNP
        if (!ic_set_manually) {
index 6efc03df51c3b1b72d13b850a512178ddf9dd067..1fb6323e65a4ec88ce0df377d7b1b770d1e856ed 100644 (file)
@@ -335,7 +335,7 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu)
 
        p = fork_idle(cpu);
        callin_flag = 0;
-       cpu_new_thread = p->thread_info;
+       cpu_new_thread = task_thread_info(p);
        cpu_set(cpu, cpu_callout_map);
 
        cpu_find_by_mid(cpu, &cpu_node);
index de342ee3116b05b5412e4e91e01815805872e15e..d4b7a100cb8ac5cf61f59b8522cf90f7e116fc57 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/capability.h>
 #include <linux/fs.h> 
 #include <linux/mm.h> 
 #include <linux/file.h> 
index bfa4aa68312dcabd6d4c080c5ea4dbf14e117a46..ae5b32f817f0e33948ab8a25bb0aa687d77ab1ed 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/compat.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
index 5570e7bb22bb5a34db2bc7c1fd06feeda2ffdb9f..8d44ae5a15e32f11e8ebee392ecb67a350799fa3 100644 (file)
@@ -1808,7 +1808,7 @@ static void user_instruction_dump (unsigned int __user *pc)
 void show_stack(struct task_struct *tsk, unsigned long *_ksp)
 {
        unsigned long pc, fp, thread_base, ksp;
-       struct thread_info *tp = tsk->thread_info;
+       void *tp = task_stack_page(tsk);
        struct reg_window *rw;
        int count = 0;
 
@@ -1862,7 +1862,7 @@ static inline int is_kernel_stack(struct task_struct *task,
                        return 0;
        }
 
-       thread_base = (unsigned long) task->thread_info;
+       thread_base = (unsigned long) task_stack_page(task);
        thread_end = thread_base + sizeof(union thread_union);
        if (rw_addr >= thread_base &&
            rw_addr < thread_end &&
index d7c99fa89661de5dacf5d45b1a625dc26aeb9ac5..4885ca6cbc777dc2cf0623650db158cc0a5772a8 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/namei.h>
 #include <linux/mm.h>
index b4ff2e5760215460fcaa79fa859c826d479d26e3..8ff3bcbce5fcb5172dd75a6469b14ba02056e283 100644 (file)
@@ -35,12 +35,12 @@ menu "UML-specific options"
 
 config MODE_TT
        bool "Tracing thread support"
-       default y
+       default n
        help
        This option controls whether tracing thread support is compiled
-       into UML.  Normally, this should be set to Y.  If you intend to
-       use only skas mode (and the host has the skas patch applied to it),
-       then it is OK to say N here.
+       into UML.  This option is largely obsolete, given that skas0 provides
+       skas security and performance without needing to patch the host.
+       It is safe to say 'N' here.
 
 config STATIC_LINK
        bool "Force a static link"
index 1b12feeba368bac33c3aecefb822c051ff2615c7..322972fd064eac3d45f363c4dd87f56da500d406 100644 (file)
@@ -189,6 +189,12 @@ define filechk_umlconfig
        sed 's/ CONFIG/ UML_CONFIG/'
 endef
 
+$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
+       $(call filechk,umlconfig)
+
+$(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c
+       $(CC) $(USER_CFLAGS) -S -o $@ $<
+
 define filechk_gen-asm-offsets
         (set -e; \
          echo "/*"; \
@@ -202,24 +208,13 @@ define filechk_gen-asm-offsets
          echo ""; )
 endef
 
-$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
-       $(call filechk,umlconfig)
-
-$(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c
-       $(CC) $(USER_CFLAGS) -S -o $@ $<
-
 $(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s
        $(call filechk,gen-asm-offsets)
 
 CLEAN_FILES += $(ARCH_DIR)/user-offsets.s
 
-$(ARCH_DIR)/kernel-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/kernel-offsets.c \
-                                  archprepare
-       $(CC) $(CFLAGS) $(NOSTDINC_FLAGS) $(CPPFLAGS) -S -o $@ $<
-
-$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/kernel-offsets.s
-       $(call filechk,gen-asm-offsets)
-
-CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s
+$(ARCH_DIR)/include/kern_constants.h:
+       @echo '  SYMLINK $@'
+       $(Q) ln -sf ../../../include/asm-um/asm-offsets.h $@
 
 export SUBARCH USER_CFLAGS OS
index be610125429ff47a7ea927872a7133c940ae2b68..e3d576567172bd9e64a854f7ab702eec34f05c6d 100644 (file)
@@ -500,7 +500,7 @@ static void console_write(struct console *console, const char *string,
 
 static struct console mc_console = { .name     = "mc",
                                     .write     = console_write,
-                                    .flags     = CON_PRINTBUFFER | CON_ENABLED,
+                                    .flags     = CON_ENABLED,
                                     .index     = -1 };
 
 static int mc_add_console(void)
index 3a93c6f772fa3aa0bac0de3d6f3ec977dc545a3b..7696f8d2d89c75cb21df2fb7727366d167c73730 100644 (file)
@@ -1073,7 +1073,6 @@ static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 static int ubd_ioctl(struct inode * inode, struct file * file,
                     unsigned int cmd, unsigned long arg)
 {
-       struct hd_geometry __user *loc = (struct hd_geometry __user *) arg;
        struct ubd *dev = inode->i_bdev->bd_disk->private_data;
        struct hd_driveid ubd_id = {
                .cyls           = 0,
similarity index 80%
rename from arch/um/sys-i386/kernel-offsets.c
rename to arch/um/include/sysdep-i386/kernel-offsets.h
index 35db850575066e5a34125f674d0257e98a24f8ee..82f96c574144cbc327daa8b5c82624014bb9cf83 100644 (file)
@@ -1,12 +1,9 @@
-#include <linux/config.h>
 #include <linux/stddef.h>
 #include <linux/sched.h>
-#include <linux/time.h>
 #include <linux/elf.h>
-#include <asm/page.h>
 
 #define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+       asm volatile("\n->" #sym " %0 " #val : : "i" (val))
 
 #define STR(x) #x
 #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : )
similarity index 90%
rename from arch/um/sys-x86_64/kernel-offsets.c
rename to arch/um/include/sysdep-x86_64/kernel-offsets.h
index bfcb104b846ee8731d3a73f1df5e09a56fcb4fb5..5ce93abd0b54fd79f95dea8df40cf3a756366bc0 100644 (file)
@@ -6,7 +6,7 @@
 #include <asm/page.h>
 
 #define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+       asm volatile("\n->" #sym " %0 " #val : : "i" (val))
 
 #define DEFINE_STR1(x) #x
 #define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : )
index c13a64a288f6927b681f4e27e98134bed766348f..91ea538e1612b5d75e6c645436936ad2820460d0 100644 (file)
@@ -1 +1 @@
-/* Dummy file to make kbuild happy - unused! */
+#include "sysdep/kernel-offsets.h"
index d2d3f256778cb4371ab8f5a3b060a6885f757271..7f13b85d26564609d2f1c2fca954024a3bf28a4f 100644 (file)
@@ -107,7 +107,7 @@ void set_current(void *t)
 {
        struct task_struct *task = t;
 
-       cpu_tasks[task->thread_info->cpu] = ((struct cpu_task) 
+       cpu_tasks[task_thread_info(task)->cpu] = ((struct cpu_task)
                { external_pid(task), task });
 }
 
index 9264d4021dfe23f73c0adb02d65fdf3eeea25914..3b3955d844070f781f7d3b1ffe69ef969ae395ff 100644 (file)
@@ -68,7 +68,7 @@ void wait_stub_done(int pid, int sig, char * fname)
 
         if((n < 0) || !WIFSTOPPED(status) ||
            (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
-               unsigned long regs[FRAME_SIZE];
+               unsigned long regs[HOST_FRAME_SIZE];
                if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
                        printk("Failed to get registers from stub, "
                               "errno = %d\n", errno);
@@ -76,7 +76,7 @@ void wait_stub_done(int pid, int sig, char * fname)
                        int i;
 
                        printk("Stub registers -\n");
-                       for(i = 0; i < FRAME_SIZE; i++)
+                       for(i = 0; i < HOST_FRAME_SIZE; i++)
                                printk("\t%d - %lx\n", i, regs[i]);
                }
                 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
index 09790ccb161ca7ddae9c91136ed805a2dc62a8dc..dc41c6dc2f343cce1fb28723a76534221be30e3b 100644 (file)
@@ -118,7 +118,7 @@ int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp,
                handler = new_thread_handler;
        }
 
-       new_thread(p->thread_info, &p->thread.mode.skas.switch_buf,
+       new_thread(task_stack_page(p), &p->thread.mode.skas.switch_buf,
                   &p->thread.mode.skas.fork_buf, handler);
        return(0);
 }
@@ -185,7 +185,7 @@ int start_uml_skas(void)
 
        init_task.thread.request.u.thread.proc = start_kernel_proc;
        init_task.thread.request.u.thread.arg = NULL;
-       return(start_idle_thread(init_task.thread_info,
+       return(start_idle_thread(task_stack_page(&init_task),
                                 &init_task.thread.mode.skas.switch_buf,
                                 &init_task.thread.mode.skas.fork_buf));
 }
index 136e54c47d37fd1052304d5f11164fe53b2c15a8..8f40e4838736988645c1960b8e302d7ca52f48db 100644 (file)
@@ -39,7 +39,7 @@ void flush_thread_tt(void)
                do_exit(SIGKILL);
        }
                
-       new_pid = start_fork_tramp(current->thread_info, stack, 0, exec_tramp);
+       new_pid = start_fork_tramp(task_stack_page(current), stack, 0, exec_tramp);
        if(new_pid < 0){
                printk(KERN_ERR 
                       "flush_thread : new thread failed, errno = %d\n",
index 14d4622a5fb86ffbd9750f9d8ce6adf34dbf03b6..62535303aa277233241650a8c0a8686d1a6fb9c8 100644 (file)
@@ -36,7 +36,7 @@ void switch_to_tt(void *prev, void *next)
        from = prev;
        to = next;
 
-       cpu = from->thread_info->cpu;
+       cpu = task_thread_info(from)->cpu;
        if(cpu == 0)
                forward_interrupts(to->thread.mode.tt.extern_pid);
 #ifdef CONFIG_SMP
@@ -253,7 +253,7 @@ int copy_thread_tt(int nr, unsigned long clone_flags, unsigned long sp,
 
        clone_flags &= CLONE_VM;
        p->thread.temp_stack = stack;
-       new_pid = start_fork_tramp(p->thread_info, stack, clone_flags, tramp);
+       new_pid = start_fork_tramp(task_stack_page(p), stack, clone_flags, tramp);
        if(new_pid < 0){
                printk(KERN_ERR "copy_thread : clone failed - errno = %d\n", 
                       -new_pid);
@@ -343,7 +343,7 @@ int do_proc_op(void *t, int proc_id)
                pid = thread->request.u.exec.pid;
                do_exec(thread->mode.tt.extern_pid, pid);
                thread->mode.tt.extern_pid = pid;
-               cpu_tasks[task->thread_info->cpu].pid = pid;
+               cpu_tasks[task_thread_info(task)->cpu].pid = pid;
                break;
        case OP_FORK:
                attach_process(thread->request.u.fork.pid);
@@ -425,7 +425,7 @@ int start_uml_tt(void)
        int pages;
 
        pages = (1 << CONFIG_KERNEL_STACK_ORDER);
-       sp = (void *) ((unsigned long) init_task.thread_info) +
+       sp = task_stack_page(&init_task) +
                pages * PAGE_SIZE - sizeof(unsigned long);
        return(tracer(start_kernel_proc, sp));
 }
index 73747ac197748d6deb1649f0b59b4b1aad1d7051..e2d3ca445ef57388f848f79174135757f34f7c36 100644 (file)
@@ -243,10 +243,6 @@ static int __init mode_tt_setup(char *line, int *add)
        return(0);
 }
 
-#else
-
-#error Either CONFIG_MODE_TT or CONFIG_MODE_SKAS must be enabled
-
 #endif
 #endif
 #endif
index 062ffa0a9998100205dcf30f0f503c448e604e89..eb909937958bcd5ba44c1a02121910ba63a7cd82 100644 (file)
@@ -114,7 +114,7 @@ int copy_thread (int nr, unsigned long clone_flags,
                 struct task_struct *p, struct pt_regs *regs)
 {
        /* Start pushing stuff from the top of the child's kernel stack.  */
-       unsigned long orig_ksp = (unsigned long)p->thread_info + THREAD_SIZE;
+       unsigned long orig_ksp = task_tos(p);
        unsigned long ksp = orig_ksp;
        /* We push two `state save' stack fames (see entry.S) on the new
           kernel stack:
index 18492d02aaf6dcffb146233fe14450493c9fcbce..67e057509664a89daa48936f1741ad711464f89c 100644 (file)
@@ -58,7 +58,7 @@ static v850_reg_t *reg_save_addr (unsigned reg_offs, struct task_struct *t)
                regs = thread_saved_regs (t);
        else
                /* Register saved during kernel entry (or not available).  */
-               regs = task_regs (t);
+               regs = task_pt_regs (t);
 
        return (v850_reg_t *)((char *)regs + reg_offs);
 }
index 348b4a0d0d6f69c459240d6fc4d75c152440b132..2efc4be227095f6c59c3502d72617bf39705eb37 100644 (file)
@@ -69,11 +69,33 @@ config ARCH_MAY_HAVE_PC_FDC
        bool
        default y
 
+config DMI
+       bool
+       default y
+
 source "init/Kconfig"
 
 
 menu "Processor type and features"
 
+choice
+       prompt "Subarchitecture Type"
+       default X86_PC
+
+config X86_PC
+       bool "PC-compatible"
+       help
+         Choose this option if your computer is a standard PC or compatible.
+
+config X86_VSMP
+       bool "Support for ScaleMP vSMP"
+        help
+         Support for ScaleMP vSMP systems.  Say 'Y' here if this kernel is
+         supposed to run on these EM64T-based machines.  Only choose this option
+         if you have one of these machines.
+
+endchoice
+
 choice
        prompt "Processor family"
        default MK8
@@ -347,32 +369,24 @@ config HPET_EMULATE_RTC
        depends on HPET_TIMER && RTC=y
 
 config GART_IOMMU
-       bool "IOMMU support"
+       bool "K8 GART IOMMU support"
        default y
+       select SWIOTLB
        depends on PCI
        help
          Support the IOMMU. Needed to run systems with more than 3GB of memory
          properly with 32-bit PCI devices that do not support DAC (Double Address
          Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter.
          Normally the kernel will take the right choice by itself.
-         This option includes a driver for the AMD Opteron/Athlon64 IOMMU
-         and a software emulation used on some other systems.
+         This option includes a driver for the AMD Opteron/Athlon64 northbridge IOMMU
+         and a software emulation used on other systems.
          If unsure, say Y.
 
 # need this always enabled with GART_IOMMU for the VIA workaround
 config SWIOTLB
-       bool
-       depends on GART_IOMMU
-       default y
-
-config DUMMY_IOMMU
        bool
-       depends on !GART_IOMMU && !SWIOTLB
        default y
-       help
-         Don't use IOMMU code. This will cause problems when you have more than 4GB
-         of memory and any 32-bit devices. Don't turn on unless you know what you
-         are doing.
+       depends on GART_IOMMU
 
 config X86_MCE
        bool "Machine check support" if EMBEDDED
index 51d83288d62b499d8b863113a7094ff71f954cc4..d7fd46479c559a2ac0c4462a8a7cb16bce5b9c30 100644 (file)
@@ -31,6 +31,7 @@ cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
 cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
 CFLAGS += $(cflags-y)
 
+CFLAGS += -m64
 CFLAGS += -mno-red-zone
 CFLAGS += -mcmodel=kernel
 CFLAGS += -pipe
@@ -38,8 +39,10 @@ CFLAGS += -pipe
 # actually it makes the kernel smaller too.
 CFLAGS += -fno-reorder-blocks  
 CFLAGS += -Wno-sign-compare
-ifneq ($(CONFIG_DEBUG_INFO),y)
+ifneq ($(CONFIG_UNWIND_INFO),y)
 CFLAGS += -fno-asynchronous-unwind-tables
+endif
+ifneq ($(CONFIG_DEBUG_INFO),y)
 # -fweb shrinks the kernel a bit, but the difference is very small
 # it also messes up debugging, so don't use it for now.
 #CFLAGS += $(call cc-option,-fweb)
@@ -50,6 +53,8 @@ CFLAGS += $(call cc-option,-funit-at-a-time)
 # prevent gcc from generating any FP code by mistake
 CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
 
+AFLAGS += -m64
+
 head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
 
 libs-y                                         += arch/x86_64/lib/
index 5d56542fb68f004737be94ed09d376f92507ab68..054dcd8a5e9de6b00564a9d6db43759c4c947d99 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.14-git7
-# Sat Nov  5 15:55:50 2005
+# Linux kernel version: 2.6.15-git7
+# Wed Jan 11 11:57:36 2006
 #
 CONFIG_X86_64=y
 CONFIG_64BIT=y
@@ -15,6 +15,7 @@ CONFIG_EARLY_PRINTK=y
 CONFIG_GENERIC_ISA_DMA=y
 CONFIG_GENERIC_IOMAP=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_DMI=y
 
 #
 # Code maturity level options
@@ -35,18 +36,21 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 # CONFIG_AUDIT is not set
-CONFIG_HOTPLUG=y
-CONFIG_KOBJECT_UEVENT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_CPUSETS is not set
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_UID16=y
+CONFIG_VM86=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
+CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
@@ -55,8 +59,10 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
 CONFIG_CC_ALIGN_LABELS=0
 CONFIG_CC_ALIGN_LOOPS=0
 CONFIG_CC_ALIGN_JUMPS=0
+CONFIG_SLAB=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
+# CONFIG_SLOB is not set
 
 #
 # Loadable module support
@@ -70,9 +76,29 @@ CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_KMOD is not set
 CONFIG_STOP_MACHINE=y
 
+#
+# Block layer
+#
+CONFIG_LBD=y
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_AS is not set
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_DEFAULT_AS is not set
+# CONFIG_DEFAULT_DEADLINE is not set
+CONFIG_DEFAULT_CFQ=y
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="cfq"
+
 #
 # Processor type and features
 #
+CONFIG_X86_PC=y
+# CONFIG_X86_VSMP is not set
 # CONFIG_MK8 is not set
 # CONFIG_MPSC is not set
 CONFIG_GENERIC_CPU=y
@@ -89,14 +115,14 @@ CONFIG_X86_LOCAL_APIC=y
 CONFIG_MTRR=y
 CONFIG_SMP=y
 CONFIG_SCHED_SMT=y
-CONFIG_PREEMPT_NONE=y
-# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT_NONE is not set
+CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
 CONFIG_PREEMPT_BKL=y
 CONFIG_NUMA=y
 CONFIG_K8_NUMA=y
 CONFIG_X86_64_ACPI_NUMA=y
-# CONFIG_NUMA_EMU is not set
+CONFIG_NUMA_EMU=y
 CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
 CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -109,6 +135,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_NEED_MULTIPLE_NODES=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_MIGRATION=y
 CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
 CONFIG_NR_CPUS=32
 CONFIG_HOTPLUG_CPU=y
@@ -120,8 +147,9 @@ CONFIG_SWIOTLB=y
 CONFIG_X86_MCE=y
 CONFIG_X86_MCE_INTEL=y
 CONFIG_X86_MCE_AMD=y
-CONFIG_PHYSICAL_START=0x100000
 # CONFIG_KEXEC is not set
+# CONFIG_CRASH_DUMP is not set
+CONFIG_PHYSICAL_START=0x100000
 CONFIG_SECCOMP=y
 # CONFIG_HZ_100 is not set
 CONFIG_HZ_250=y
@@ -136,6 +164,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
 # Power management options
 #
 CONFIG_PM=y
+# CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 CONFIG_SOFTWARE_SUSPEND=y
 CONFIG_PM_STD_PARTITION=""
@@ -152,7 +181,7 @@ CONFIG_ACPI_AC=y
 CONFIG_ACPI_BATTERY=y
 CONFIG_ACPI_BUTTON=y
 # CONFIG_ACPI_VIDEO is not set
-CONFIG_ACPI_HOTKEY=m
+# CONFIG_ACPI_HOTKEY is not set
 CONFIG_ACPI_FAN=y
 CONFIG_ACPI_PROCESSOR=y
 CONFIG_ACPI_HOTPLUG_CPU=y
@@ -205,7 +234,7 @@ CONFIG_PCI=y
 CONFIG_PCI_DIRECT=y
 CONFIG_PCI_MMCONFIG=y
 CONFIG_UNORDERED_IO=y
-# CONFIG_PCIEPORTBUS is not set
+CONFIG_PCIEPORTBUS=y
 CONFIG_PCI_MSI=y
 # CONFIG_PCI_LEGACY_PROC is not set
 # CONFIG_PCI_DEBUG is not set
@@ -229,7 +258,6 @@ CONFIG_IA32_EMULATION=y
 CONFIG_IA32_AOUT=y
 CONFIG_COMPAT=y
 CONFIG_SYSVIPC_COMPAT=y
-CONFIG_UID16=y
 
 #
 # Networking
@@ -294,8 +322,11 @@ CONFIG_IPV6=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
 # CONFIG_NET_SCHED is not set
-# CONFIG_NET_CLS_ROUTE is not set
 
 #
 # Network testing
@@ -315,7 +346,7 @@ CONFIG_IPV6=y
 #
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_FW_LOADER is not set
+CONFIG_FW_LOADER=y
 # CONFIG_DEBUG_DRIVER is not set
 
 #
@@ -356,21 +387,7 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
-CONFIG_LBD=y
 # CONFIG_CDROM_PKTCDVD is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
-CONFIG_DEFAULT_DEADLINE=y
-# CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="cfq"
 # CONFIG_ATA_OVER_ETH is not set
 
 #
@@ -410,7 +427,7 @@ CONFIG_IDEDMA_PCI_AUTO=y
 # CONFIG_BLK_DEV_AEC62XX is not set
 # CONFIG_BLK_DEV_ALI15X3 is not set
 CONFIG_BLK_DEV_AMD74XX=y
-# CONFIG_BLK_DEV_ATIIXP is not set
+CONFIG_BLK_DEV_ATIIXP=y
 # CONFIG_BLK_DEV_CMD64X is not set
 # CONFIG_BLK_DEV_TRIFLEX is not set
 # CONFIG_BLK_DEV_CY82C693 is not set
@@ -458,20 +475,21 @@ CONFIG_BLK_DEV_SD=y
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 # CONFIG_SCSI_MULTI_LUN is not set
-# CONFIG_SCSI_CONSTANTS is not set
+CONFIG_SCSI_CONSTANTS=y
 # CONFIG_SCSI_LOGGING is not set
 
 #
 # SCSI Transport Attributes
 #
 CONFIG_SCSI_SPI_ATTRS=y
-# CONFIG_SCSI_FC_ATTRS is not set
+CONFIG_SCSI_FC_ATTRS=y
 # CONFIG_SCSI_ISCSI_ATTRS is not set
 # CONFIG_SCSI_SAS_ATTRS is not set
 
 #
 # SCSI low-level drivers
 #
+# CONFIG_ISCSI_TCP is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
 # CONFIG_SCSI_3W_9XXX is not set
 # CONFIG_SCSI_ACARD is not set
@@ -485,11 +503,13 @@ CONFIG_AIC79XX_RESET_DELAY_MS=4000
 # CONFIG_AIC79XX_DEBUG_ENABLE is not set
 CONFIG_AIC79XX_DEBUG_MASK=0
 # CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
-# CONFIG_MEGARAID_NEWGEN is not set
+CONFIG_MEGARAID_NEWGEN=y
+CONFIG_MEGARAID_MM=y
+CONFIG_MEGARAID_MAILBOX=y
 # CONFIG_MEGARAID_LEGACY is not set
-# CONFIG_MEGARAID_SAS is not set
+CONFIG_MEGARAID_SAS=y
 CONFIG_SCSI_SATA=y
-# CONFIG_SCSI_SATA_AHCI is not set
+CONFIG_SCSI_SATA_AHCI=y
 # CONFIG_SCSI_SATA_SVW is not set
 CONFIG_SCSI_ATA_PIIX=y
 # CONFIG_SCSI_SATA_MV is not set
@@ -498,7 +518,7 @@ CONFIG_SCSI_SATA_NV=y
 # CONFIG_SCSI_SATA_QSTOR is not set
 # CONFIG_SCSI_SATA_PROMISE is not set
 # CONFIG_SCSI_SATA_SX4 is not set
-# CONFIG_SCSI_SATA_SIL is not set
+CONFIG_SCSI_SATA_SIL=y
 # CONFIG_SCSI_SATA_SIL24 is not set
 # CONFIG_SCSI_SATA_SIS is not set
 # CONFIG_SCSI_SATA_ULI is not set
@@ -518,12 +538,7 @@ CONFIG_SCSI_SATA_INTEL_COMBINED=y
 # CONFIG_SCSI_QLOGIC_FC is not set
 # CONFIG_SCSI_QLOGIC_1280 is not set
 CONFIG_SCSI_QLA2XXX=y
-# CONFIG_SCSI_QLA21XX is not set
-# CONFIG_SCSI_QLA22XX is not set
-# CONFIG_SCSI_QLA2300 is not set
-# CONFIG_SCSI_QLA2322 is not set
-# CONFIG_SCSI_QLA6312 is not set
-# CONFIG_SCSI_QLA24XX is not set
+# CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE is not set
 # CONFIG_SCSI_LPFC is not set
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
@@ -633,6 +648,7 @@ CONFIG_E1000=y
 # CONFIG_R8169 is not set
 # CONFIG_SIS190 is not set
 # CONFIG_SKGE is not set
+# CONFIG_SKY2 is not set
 # CONFIG_SK98LIN is not set
 # CONFIG_VIA_VELOCITY is not set
 CONFIG_TIGON3=y
@@ -645,7 +661,6 @@ CONFIG_TIGON3=y
 # CONFIG_IXGB is not set
 CONFIG_S2IO=m
 # CONFIG_S2IO_NAPI is not set
-# CONFIG_2BUFF_MODE is not set
 
 #
 # Token Ring devices
@@ -744,6 +759,7 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 # CONFIG_SERIAL_8250_ACPI is not set
 CONFIG_SERIAL_8250_NR_UARTS=4
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
 # CONFIG_SERIAL_8250_EXTENDED is not set
 
 #
@@ -751,7 +767,6 @@ CONFIG_SERIAL_8250_NR_UARTS=4
 #
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
-# CONFIG_SERIAL_JSM is not set
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
@@ -817,10 +832,10 @@ CONFIG_AGP_INTEL=y
 # CONFIG_DRM is not set
 # CONFIG_MWAVE is not set
 CONFIG_RAW_DRIVER=y
+CONFIG_MAX_RAW_DEVS=256
 CONFIG_HPET=y
 # CONFIG_HPET_RTC_IRQ is not set
 CONFIG_HPET_MMAP=y
-CONFIG_MAX_RAW_DEVS=256
 # CONFIG_HANGCHECK_TIMER is not set
 
 #
@@ -892,6 +907,7 @@ CONFIG_SOUND=y
 # Open Sound System
 #
 CONFIG_SOUND_PRIME=y
+CONFIG_OBSOLETE_OSS_DRIVER=y
 # CONFIG_SOUND_BT878 is not set
 # CONFIG_SOUND_CMPCI is not set
 # CONFIG_SOUND_EMU10K1 is not set
@@ -968,7 +984,8 @@ CONFIG_USB_STORAGE=y
 # CONFIG_USB_STORAGE_SDDR09 is not set
 # CONFIG_USB_STORAGE_SDDR55 is not set
 # CONFIG_USB_STORAGE_JUMPSHOT is not set
-# CONFIG_USB_STORAGE_ONETOUCH is not set
+# CONFIG_USB_STORAGE_ALAUDA is not set
+# CONFIG_USB_LIBUSUAL is not set
 
 #
 # USB Input Devices
@@ -988,6 +1005,7 @@ CONFIG_USB_HIDINPUT=y
 # CONFIG_USB_YEALINK is not set
 # CONFIG_USB_XPAD is not set
 # CONFIG_USB_ATI_REMOTE is not set
+# CONFIG_USB_ATI_REMOTE2 is not set
 # CONFIG_USB_KEYSPAN_REMOTE is not set
 # CONFIG_USB_APPLETOUCH is not set
 
@@ -1097,6 +1115,7 @@ CONFIG_REISERFS_FS_POSIX_ACL=y
 # CONFIG_JFS_FS is not set
 CONFIG_FS_POSIX_ACL=y
 # CONFIG_XFS_FS is not set
+# CONFIG_OCFS2_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 CONFIG_INOTIFY=y
@@ -1135,6 +1154,7 @@ CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
 CONFIG_RAMFS=y
 CONFIG_RELAYFS_FS=y
+# CONFIG_CONFIGFS_FS is not set
 
 #
 # Miscellaneous filesystems
@@ -1232,21 +1252,23 @@ CONFIG_NLS_ISO8859_15=y
 CONFIG_NLS_UTF8=y
 
 #
-# Profiling support
+# Instrumentation Support
 #
 CONFIG_PROFILING=y
 CONFIG_OPROFILE=y
+CONFIG_KPROBES=y
 
 #
 # Kernel hacking
 #
 # CONFIG_PRINTK_TIME is not set
-CONFIG_DEBUG_KERNEL=y
 CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_KERNEL=y
 CONFIG_LOG_BUF_SHIFT=18
 CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_MUTEXES is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -1256,8 +1278,8 @@ CONFIG_DEBUG_FS=y
 # CONFIG_FRAME_POINTER is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 CONFIG_INIT_DEBUG=y
+# CONFIG_DEBUG_RODATA is not set
 # CONFIG_IOMMU_DEBUG is not set
-CONFIG_KPROBES=y
 
 #
 # Security options
index 2b760d0d9ce292a515af2977f5423d8f26b75069..029bddab045980ccb089242353ff33b08aaa7166 100644 (file)
@@ -197,8 +197,7 @@ static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *re
 
 static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs)
 {      
-       struct pt_regs *pp = (struct pt_regs *)(t->thread.rsp0);
-       --pp;
+       struct pt_regs *pp = task_pt_regs(t);
        ELF_CORE_COPY_REGS((*elfregs), pp);
        /* fix wrong segments */ 
        (*elfregs)[7] = t->thread.ds; 
@@ -217,7 +216,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
        if (!tsk_used_math(tsk))
                return 0;
        if (!regs)
-               regs = ((struct pt_regs *)tsk->thread.rsp0) - 1;
+               regs = task_pt_regs(tsk);
        if (tsk == current)
                unlazy_fpu(tsk);
        set_fs(KERNEL_DS); 
@@ -233,7 +232,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
 static inline int 
 elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
 {
-       struct pt_regs *regs = ((struct pt_regs *)(t->thread.rsp0))-1; 
+       struct pt_regs *regs = task_pt_regs(t);
        if (!tsk_used_math(t))
                return 0;
        if (t == current)
index 0903cc1faef22a34a9e74d3e3934f0889b701b13..e0a92439f6342a350d45feaca527ed5b9e9e3426 100644 (file)
@@ -353,7 +353,6 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __
                 struct pt_regs *regs, unsigned int mask)
 {
        int tmp, err = 0;
-       u32 eflags;
 
        tmp = 0;
        __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
@@ -378,10 +377,7 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __
        err |= __put_user(current->thread.trap_no, &sc->trapno);
        err |= __put_user(current->thread.error_code, &sc->err);
        err |= __put_user((u32)regs->rip, &sc->eip);
-       eflags = regs->eflags;
-       if (current->ptrace & PT_PTRACED)
-               eflags &= ~TF_MASK;
-       err |= __put_user((u32)eflags, &sc->eflags);
+       err |= __put_user((u32)regs->eflags, &sc->eflags);
        err |= __put_user((u32)regs->rsp, &sc->esp_at_signal);
 
        tmp = save_i387_ia32(current, fpstate, regs, 0);
@@ -505,13 +501,9 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
        regs->ss = __USER32_DS; 
 
        set_fs(USER_DS);
-       if (regs->eflags & TF_MASK) {
-               if (current->ptrace & PT_PTRACED) {
-                       ptrace_notify(SIGTRAP);
-               } else {
-                       regs->eflags &= ~TF_MASK;
-               }
-       }
+    regs->eflags &= ~TF_MASK;
+    if (test_thread_flag(TIF_SINGLESTEP))
+        ptrace_notify(SIGTRAP);
 
 #if DEBUG_SIG
        printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
@@ -605,13 +597,9 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
        regs->ss = __USER32_DS; 
 
        set_fs(USER_DS);
-       if (regs->eflags & TF_MASK) {
-               if (current->ptrace & PT_PTRACED) {
-                       ptrace_notify(SIGTRAP);
-               } else {
-                       regs->eflags &= ~TF_MASK;
-               }
-       }
+    regs->eflags &= ~TF_MASK;
+    if (test_thread_flag(TIF_SINGLESTEP))
+        ptrace_notify(SIGTRAP);
 
 #if DEBUG_SIG
        printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
index 2ff07b47ea9cfe99318f90663ba601287e36c52d..58f5bfb52c63e2cb478f402cc9d7c8f3b259f3ef 100644 (file)
        movq    %rax,R8(%rsp)
        .endm
 
+       .macro CFI_STARTPROC32 simple
+       CFI_STARTPROC   \simple
+       CFI_UNDEFINED   r8
+       CFI_UNDEFINED   r9
+       CFI_UNDEFINED   r10
+       CFI_UNDEFINED   r11
+       CFI_UNDEFINED   r12
+       CFI_UNDEFINED   r13
+       CFI_UNDEFINED   r14
+       CFI_UNDEFINED   r15
+       .endm
+
 /*
  * 32bit SYSENTER instruction entry.
  *
@@ -55,7 +67,7 @@
  * with the int 0x80 path.
  */    
 ENTRY(ia32_sysenter_target)
-       CFI_STARTPROC   simple
+       CFI_STARTPROC32 simple
        CFI_DEF_CFA     rsp,0
        CFI_REGISTER    rsp,rbp
        swapgs
@@ -92,6 +104,7 @@ ENTRY(ia32_sysenter_target)
        .quad 1b,ia32_badarg
        .previous       
        GET_THREAD_INFO(%r10)
+       orl    $TS_COMPAT,threadinfo_status(%r10)
        testl  $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
        CFI_REMEMBER_STATE
        jnz  sysenter_tracesys
@@ -105,6 +118,7 @@ sysenter_do_call:
        cli
        testl   $_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
        jnz     int_ret_from_sys_call
+       andl    $~TS_COMPAT,threadinfo_status(%r10)
        /* clear IF, that popfq doesn't enable interrupts early */
        andl  $~0x200,EFLAGS-R11(%rsp) 
        RESTORE_ARGS 1,24,1,1,1,1
@@ -161,7 +175,7 @@ sysenter_tracesys:
  * with the int 0x80 path.     
  */    
 ENTRY(ia32_cstar_target)
-       CFI_STARTPROC   simple
+       CFI_STARTPROC32 simple
        CFI_DEF_CFA     rsp,0
        CFI_REGISTER    rip,rcx
        /*CFI_REGISTER  rflags,r11*/
@@ -191,6 +205,7 @@ ENTRY(ia32_cstar_target)
        .quad 1b,ia32_badarg
        .previous       
        GET_THREAD_INFO(%r10)
+       orl   $TS_COMPAT,threadinfo_status(%r10)
        testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
        CFI_REMEMBER_STATE
        jnz   cstar_tracesys
@@ -204,6 +219,7 @@ cstar_do_call:
        cli
        testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
        jnz  int_ret_from_sys_call
+       andl $~TS_COMPAT,threadinfo_status(%r10)
        RESTORE_ARGS 1,-ARG_SKIP,1,1,1
        movl RIP-ARGOFFSET(%rsp),%ecx
        CFI_REGISTER rip,rcx
@@ -276,6 +292,7 @@ ENTRY(ia32_syscall)
           this could be a problem. */
        SAVE_ARGS 0,0,1
        GET_THREAD_INFO(%r10)
+       orl   $TS_COMPAT,threadinfo_status(%r10)
        testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
        jnz ia32_tracesys
 ia32_do_syscall:       
@@ -318,7 +335,7 @@ quiet_ni_syscall:
        jmp  ia32_ptregs_common 
        .endm
 
-       CFI_STARTPROC
+       CFI_STARTPROC32
 
        PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi
        PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi
@@ -333,8 +350,19 @@ quiet_ni_syscall:
 
 ENTRY(ia32_ptregs_common)
        popq %r11
-       CFI_ADJUST_CFA_OFFSET -8
-       CFI_REGISTER rip, r11
+       CFI_ENDPROC
+       CFI_STARTPROC32 simple
+       CFI_DEF_CFA     rsp,SS+8-ARGOFFSET
+       CFI_REL_OFFSET  rax,RAX-ARGOFFSET
+       CFI_REL_OFFSET  rcx,RCX-ARGOFFSET
+       CFI_REL_OFFSET  rdx,RDX-ARGOFFSET
+       CFI_REL_OFFSET  rsi,RSI-ARGOFFSET
+       CFI_REL_OFFSET  rdi,RDI-ARGOFFSET
+       CFI_REL_OFFSET  rip,RIP-ARGOFFSET
+/*     CFI_REL_OFFSET  cs,CS-ARGOFFSET*/
+/*     CFI_REL_OFFSET  rflags,EFLAGS-ARGOFFSET*/
+       CFI_REL_OFFSET  rsp,RSP-ARGOFFSET
+/*     CFI_REL_OFFSET  ss,SS-ARGOFFSET*/
        SAVE_REST
        call *%rax
        RESTORE_REST
index 5f4cdfa56901ef4528c4850a8a225f246a672a13..23a4515a73b4024c9fb4254ec769e465e0c6fec8 100644 (file)
 #include <asm/i387.h>
 #include <asm/fpu32.h>
 
-/* determines which flags the user has access to. */
-/* 1 = access 0 = no access */
-#define FLAG_MASK 0x44dd5UL
+/*
+ * Determines which flags the user has access to [1 = access, 0 = no access].
+ * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9).
+ * Also masks reserved bits (31-22, 15, 5, 3, 1).
+ */
+#define FLAG_MASK 0x54dd5UL
 
 #define R32(l,q) \
        case offsetof(struct user32, regs.l): stack[offsetof(struct pt_regs, q)/8] = val; break
@@ -38,7 +41,7 @@
 static int putreg32(struct task_struct *child, unsigned regno, u32 val)
 {
        int i;
-       __u64 *stack = (__u64 *)(child->thread.rsp0 - sizeof(struct pt_regs)); 
+       __u64 *stack = (__u64 *)task_pt_regs(child);
 
        switch (regno) {
        case offsetof(struct user32, regs.fs):
@@ -134,7 +137,7 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 val)
 
 static int getreg32(struct task_struct *child, unsigned regno, u32 *val)
 {
-       __u64 *stack = (__u64 *)(child->thread.rsp0 - sizeof(struct pt_regs)); 
+       __u64 *stack = (__u64 *)task_pt_regs(child);
 
        switch (regno) {
        case offsetof(struct user32, regs.fs):
@@ -235,7 +238,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
        if (ret < 0)
                goto out;
 
-       childregs = (struct pt_regs *)(child->thread.rsp0 - sizeof(struct pt_regs)); 
+       childregs = task_pt_regs(child);
 
        switch (request) {
        case PTRACE_PEEKDATA:
index 8b5a4b060bb56bbf65484d483a7fa5e796b1fd6c..d90321fe9bba1ffb9d23c24fef81b924a766efe0 100644 (file)
@@ -7,6 +7,7 @@
  * by doing ".balign 32" must match in both versions of the page.
  */
 
+       .code32
        .section .text.sigreturn,"ax"
        .balign 32
        .globl __kernel_sigreturn
index b024965bb689f55705c72770a0cec9cb632ea896..cf9ef678de3e3c68a9266bc5ab975e867b14655e 100644 (file)
@@ -6,6 +6,7 @@
 #include <asm/asm-offsets.h>
 #include <asm/segment.h>
 
+       .code32
        .text
        .section .text.vsyscall,"ax"
        .globl __kernel_vsyscall
index 71f3de586b5668a9b50ef10e05077c82438c5c55..ae056e553d1365989aef36c87fa4e898312518a3 100644 (file)
@@ -5,6 +5,7 @@
 #include <asm/ia32_unistd.h>
 #include <asm/asm-offsets.h>
 
+       .code32
        .text
        .section .text.vsyscall,"ax"
        .globl __kernel_vsyscall
index 12bc54005e2faa59656ba68b272c1876e48b961f..72fe60c20d39174afcf2243fe76eee527489100e 100644 (file)
@@ -7,7 +7,8 @@ EXTRA_AFLAGS    := -traditional
 obj-y  := process.o signal.o entry.o traps.o irq.o \
                ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \
                x8664_ksyms.o i387.o syscall.o vsyscall.o \
-               setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o
+               setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \
+               dmi_scan.o pci-dma.o pci-nommu.o
 
 obj-$(CONFIG_X86_MCE)         += mce.o
 obj-$(CONFIG_X86_MCE_INTEL)    += mce_intel.o
@@ -28,9 +29,10 @@ 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)          += pci-swiotlb.o
 obj-$(CONFIG_KPROBES)          += kprobes.o
 obj-$(CONFIG_X86_PM_TIMER)     += pmtimer.o
+obj-$(CONFIG_X86_VSMP)         += vsmp.o
 
 obj-$(CONFIG_MODULES)          += module.o
 
@@ -47,3 +49,5 @@ intel_cacheinfo-y             += ../../i386/kernel/cpu/intel_cacheinfo.o
 quirks-y                       += ../../i386/kernel/quirks.o
 i8237-y                                += ../../i386/kernel/i8237.o
 msr-$(subst m,y,$(CONFIG_X86_MSR))  += ../../i386/kernel/msr.o
+dmi_scan-y                     += ../../i386/kernel/dmi_scan.o
+
index c7f4fdd20f05ff78ee731054170de372f9c0cf40..e4e2b7d01f8914c67cba5ad3bf5201db76b9ef96 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/io.h>
 #include <asm/proto.h>
 #include <asm/pci-direct.h>
+#include <asm/dma.h>
 
 int iommu_aperture;
 int iommu_aperture_disabled __initdata = 0;
@@ -247,7 +248,7 @@ void __init iommu_hole_init(void)
                /* Got the aperture from the AGP bridge */
        } else if (swiotlb && !valid_agp) {
                /* Do nothing */
-       } else if ((!no_iommu && end_pfn >= 0xffffffff>>PAGE_SHIFT) ||
+       } else if ((!no_iommu && end_pfn >= MAX_DMA32_PFN) ||
                   force_iommu ||
                   valid_agp ||
                   fallback_aper_force) { 
index 18691ce4c75921ff84bd09d4f37766511e09247a..8fdd089fd17efeeef3275f6496bc0b280978d057 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/mc146818rtc.h>
 #include <linux/kernel_stat.h>
 #include <linux/sysdev.h>
+#include <linux/module.h>
 
 #include <asm/atomic.h>
 #include <asm/smp.h>
 #include <asm/pgalloc.h>
 #include <asm/mach_apic.h>
 #include <asm/nmi.h>
+#include <asm/idle.h>
 
 int apic_verbosity;
 
 int disable_apic_timer __initdata;
 
+/*
+ * cpu_mask that denotes the CPUs that needs timer interrupt coming in as
+ * IPIs in place of local APIC timers
+ */
+static cpumask_t timer_interrupt_broadcast_ipi_mask;
+
 /* Using APIC to generate smp_local_timer_interrupt? */
 int using_apic_timer = 0;
 
-static DEFINE_PER_CPU(int, prof_multiplier) = 1;
-static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
-static DEFINE_PER_CPU(int, prof_counter) = 1;
-
 static void apic_pm_activate(void);
 
 void enable_NMI_through_LVT0 (void * dummy)
 {
-       unsigned int v, ver;
+       unsigned int v;
        
-       ver = apic_read(APIC_LVR);
-       ver = GET_APIC_VERSION(ver);
        v = APIC_DM_NMI;                        /* unmask and set to NMI */
-       apic_write_around(APIC_LVT0, v);
+       apic_write(APIC_LVT0, v);
 }
 
 int get_maxlvt(void)
 {
-       unsigned int v, ver, maxlvt;
+       unsigned int v, maxlvt;
 
        v = apic_read(APIC_LVR);
-       ver = GET_APIC_VERSION(v);
        maxlvt = GET_APIC_MAXLVT(v);
        return maxlvt;
 }
@@ -80,33 +81,33 @@ void clear_local_APIC(void)
         */
        if (maxlvt >= 3) {
                v = ERROR_APIC_VECTOR; /* any non-zero vector will do */
-               apic_write_around(APIC_LVTERR, v | APIC_LVT_MASKED);
+               apic_write(APIC_LVTERR, v | APIC_LVT_MASKED);
        }
        /*
         * Careful: we have to set masks only first to deassert
         * any level-triggered sources.
         */
        v = apic_read(APIC_LVTT);
-       apic_write_around(APIC_LVTT, v | APIC_LVT_MASKED);
+       apic_write(APIC_LVTT, v | APIC_LVT_MASKED);
        v = apic_read(APIC_LVT0);
-       apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED);
+       apic_write(APIC_LVT0, v | APIC_LVT_MASKED);
        v = apic_read(APIC_LVT1);
-       apic_write_around(APIC_LVT1, v | APIC_LVT_MASKED);
+       apic_write(APIC_LVT1, v | APIC_LVT_MASKED);
        if (maxlvt >= 4) {
                v = apic_read(APIC_LVTPC);
-               apic_write_around(APIC_LVTPC, v | APIC_LVT_MASKED);
+               apic_write(APIC_LVTPC, v | APIC_LVT_MASKED);
        }
 
        /*
         * Clean APIC state for other OSs:
         */
-       apic_write_around(APIC_LVTT, APIC_LVT_MASKED);
-       apic_write_around(APIC_LVT0, APIC_LVT_MASKED);
-       apic_write_around(APIC_LVT1, APIC_LVT_MASKED);
+       apic_write(APIC_LVTT, APIC_LVT_MASKED);
+       apic_write(APIC_LVT0, APIC_LVT_MASKED);
+       apic_write(APIC_LVT1, APIC_LVT_MASKED);
        if (maxlvt >= 3)
-               apic_write_around(APIC_LVTERR, APIC_LVT_MASKED);
+               apic_write(APIC_LVTERR, APIC_LVT_MASKED);
        if (maxlvt >= 4)
-               apic_write_around(APIC_LVTPC, APIC_LVT_MASKED);
+               apic_write(APIC_LVTPC, APIC_LVT_MASKED);
        v = GET_APIC_VERSION(apic_read(APIC_LVR));
        apic_write(APIC_ESR, 0);
        apic_read(APIC_ESR);
@@ -151,7 +152,7 @@ void disconnect_bsp_APIC(int virt_wire_setup)
                value &= ~APIC_VECTOR_MASK;
                value |= APIC_SPIV_APIC_ENABLED;
                value |= 0xf;
-               apic_write_around(APIC_SPIV, value);
+               apic_write(APIC_SPIV, value);
 
                if (!virt_wire_setup) {
                        /* For LVT0 make it edge triggered, active high, external and enabled */
@@ -161,11 +162,11 @@ void disconnect_bsp_APIC(int virt_wire_setup)
                                APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED );
                        value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
                        value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT);
-                       apic_write_around(APIC_LVT0, value);
+                       apic_write(APIC_LVT0, value);
                }
                else {
                        /* Disable LVT0 */
-                       apic_write_around(APIC_LVT0, APIC_LVT_MASKED);
+                       apic_write(APIC_LVT0, APIC_LVT_MASKED);
                }
 
                /* For LVT1 make it edge triggered, active high, nmi and enabled */
@@ -176,7 +177,7 @@ void disconnect_bsp_APIC(int virt_wire_setup)
                        APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED);
                value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
                value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI);
-               apic_write_around(APIC_LVT1, value);
+               apic_write(APIC_LVT1, value);
        }
 }
 
@@ -192,7 +193,7 @@ void disable_local_APIC(void)
         */
        value = apic_read(APIC_SPIV);
        value &= ~APIC_SPIV_APIC_ENABLED;
-       apic_write_around(APIC_SPIV, value);
+       apic_write(APIC_SPIV, value);
 }
 
 /*
@@ -269,7 +270,7 @@ void __init sync_Arb_IDs(void)
        apic_wait_icr_idle();
 
        apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
-       apic_write_around(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG
+       apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG
                                | APIC_DM_INIT);
 }
 
@@ -280,7 +281,7 @@ extern void __error_in_apic_c (void);
  */
 void __init init_bsp_APIC(void)
 {
-       unsigned int value, ver;
+       unsigned int value;
 
        /*
         * Don't do the setup now if we have a SMP BIOS as the
@@ -290,7 +291,6 @@ void __init init_bsp_APIC(void)
                return;
 
        value = apic_read(APIC_LVR);
-       ver = GET_APIC_VERSION(value);
 
        /*
         * Do not trust the local APIC being empty at bootup.
@@ -305,22 +305,21 @@ void __init init_bsp_APIC(void)
        value |= APIC_SPIV_APIC_ENABLED;
        value |= APIC_SPIV_FOCUS_DISABLED;
        value |= SPURIOUS_APIC_VECTOR;
-       apic_write_around(APIC_SPIV, value);
+       apic_write(APIC_SPIV, value);
 
        /*
         * Set up the virtual wire mode.
         */
-       apic_write_around(APIC_LVT0, APIC_DM_EXTINT);
+       apic_write(APIC_LVT0, APIC_DM_EXTINT);
        value = APIC_DM_NMI;
-       apic_write_around(APIC_LVT1, value);
+       apic_write(APIC_LVT1, value);
 }
 
 void __cpuinit setup_local_APIC (void)
 {
-       unsigned int value, ver, maxlvt;
+       unsigned int value, maxlvt;
 
        value = apic_read(APIC_LVR);
-       ver = GET_APIC_VERSION(value);
 
        if ((SPURIOUS_APIC_VECTOR & 0x0f) != 0x0f)
                __error_in_apic_c();
@@ -345,7 +344,7 @@ void __cpuinit setup_local_APIC (void)
         */
        value = apic_read(APIC_TASKPRI);
        value &= ~APIC_TPRI_MASK;
-       apic_write_around(APIC_TASKPRI, value);
+       apic_write(APIC_TASKPRI, value);
 
        /*
         * Now that we are all set up, enable the APIC
@@ -387,7 +386,7 @@ void __cpuinit setup_local_APIC (void)
         * Set spurious IRQ vector
         */
        value |= SPURIOUS_APIC_VECTOR;
-       apic_write_around(APIC_SPIV, value);
+       apic_write(APIC_SPIV, value);
 
        /*
         * Set up LVT0, LVT1:
@@ -407,7 +406,7 @@ void __cpuinit setup_local_APIC (void)
                value = APIC_DM_EXTINT | APIC_LVT_MASKED;
                apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", smp_processor_id());
        }
-       apic_write_around(APIC_LVT0, value);
+       apic_write(APIC_LVT0, value);
 
        /*
         * only the BP should see the LINT1 NMI signal, obviously.
@@ -416,14 +415,14 @@ void __cpuinit setup_local_APIC (void)
                value = APIC_DM_NMI;
        else
                value = APIC_DM_NMI | APIC_LVT_MASKED;
-       apic_write_around(APIC_LVT1, value);
+       apic_write(APIC_LVT1, value);
 
        {
                unsigned oldvalue;
                maxlvt = get_maxlvt();
                oldvalue = apic_read(APIC_ESR);
                value = ERROR_APIC_VECTOR;      // enables sending errors
-               apic_write_around(APIC_LVTERR, value);
+               apic_write(APIC_LVTERR, value);
                /*
                 * spec says clear errors after enabling vector.
                 */
@@ -660,20 +659,25 @@ void __init init_apic_mappings(void)
 static void __setup_APIC_LVTT(unsigned int clocks)
 {
        unsigned int lvtt_value, tmp_value, ver;
+       int cpu = smp_processor_id();
 
        ver = GET_APIC_VERSION(apic_read(APIC_LVR));
        lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR;
-       apic_write_around(APIC_LVTT, lvtt_value);
+
+       if (cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask))
+               lvtt_value |= APIC_LVT_MASKED;
+
+       apic_write(APIC_LVTT, lvtt_value);
 
        /*
         * Divide PICLK by 16
         */
        tmp_value = apic_read(APIC_TDCR);
-       apic_write_around(APIC_TDCR, (tmp_value
+       apic_write(APIC_TDCR, (tmp_value
                                & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE))
                                | APIC_TDR_DIV_16);
 
-       apic_write_around(APIC_TMICT, clocks/APIC_DIVISOR);
+       apic_write(APIC_TMICT, clocks/APIC_DIVISOR);
 }
 
 static void setup_APIC_timer(unsigned int clocks)
@@ -682,12 +686,6 @@ static void setup_APIC_timer(unsigned int clocks)
 
        local_irq_save(flags);
 
-       /* For some reasons this doesn't work on Simics, so fake it for now */ 
-       if (!strstr(boot_cpu_data.x86_model_id, "Screwdriver")) { 
-       __setup_APIC_LVTT(clocks);
-               return;
-       } 
-
        /* wait for irq slice */
        if (vxtime.hpet_address) {
                int trigger = hpet_readl(HPET_T0_CMP);
@@ -700,7 +698,7 @@ static void setup_APIC_timer(unsigned int clocks)
                outb_p(0x00, 0x43);
                c2 = inb_p(0x40);
                c2 |= inb_p(0x40) << 8;
-       do {
+               do {
                        c1 = c2;
                        outb_p(0x00, 0x43);
                        c2 = inb_p(0x40);
@@ -785,52 +783,68 @@ void __cpuinit setup_secondary_APIC_clock(void)
        local_irq_enable();
 }
 
-void __cpuinit disable_APIC_timer(void)
+void disable_APIC_timer(void)
 {
        if (using_apic_timer) {
                unsigned long v;
 
                v = apic_read(APIC_LVTT);
-               apic_write_around(APIC_LVTT, v | APIC_LVT_MASKED);
+               apic_write(APIC_LVTT, v | APIC_LVT_MASKED);
        }
 }
 
 void enable_APIC_timer(void)
 {
-       if (using_apic_timer) {
+       int cpu = smp_processor_id();
+
+       if (using_apic_timer &&
+           !cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) {
                unsigned long v;
 
                v = apic_read(APIC_LVTT);
-               apic_write_around(APIC_LVTT, v & ~APIC_LVT_MASKED);
+               apic_write(APIC_LVTT, v & ~APIC_LVT_MASKED);
        }
 }
 
-/*
- * the frequency of the profiling timer can be changed
- * by writing a multiplier value into /proc/profile.
- */
-int setup_profiling_timer(unsigned int multiplier)
+void switch_APIC_timer_to_ipi(void *cpumask)
 {
-       int i;
+       cpumask_t mask = *(cpumask_t *)cpumask;
+       int cpu = smp_processor_id();
 
-       /*
-        * Sanity check. [at least 500 APIC cycles should be
-        * between APIC interrupts as a rule of thumb, to avoid
-        * irqs flooding us]
-        */
-       if ( (!multiplier) || (calibration_result/multiplier < 500))
-               return -EINVAL;
-
-       /* 
-        * Set the new multiplier for each CPU. CPUs don't start using the
-        * new values until the next timer interrupt in which they do process
-        * accounting. At that time they also adjust their APIC timers
-        * accordingly.
-        */
-       for (i = 0; i < NR_CPUS; ++i)
-               per_cpu(prof_multiplier, i) = multiplier;
+       if (cpu_isset(cpu, mask) &&
+           !cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) {
+               disable_APIC_timer();
+               cpu_set(cpu, timer_interrupt_broadcast_ipi_mask);
+       }
+}
+EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
 
-       return 0;
+void smp_send_timer_broadcast_ipi(void)
+{
+       cpumask_t mask;
+
+       cpus_and(mask, cpu_online_map, timer_interrupt_broadcast_ipi_mask);
+       if (!cpus_empty(mask)) {
+               send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
+       }
+}
+
+void switch_ipi_to_APIC_timer(void *cpumask)
+{
+       cpumask_t mask = *(cpumask_t *)cpumask;
+       int cpu = smp_processor_id();
+
+       if (cpu_isset(cpu, mask) &&
+           cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) {
+               cpu_clear(cpu, timer_interrupt_broadcast_ipi_mask);
+               enable_APIC_timer();
+       }
+}
+EXPORT_SYMBOL(switch_ipi_to_APIC_timer);
+
+int setup_profiling_timer(unsigned int multiplier)
+{
+       return -EINVAL;
 }
 
 #ifdef CONFIG_X86_MCE_AMD
@@ -857,32 +871,10 @@ void setup_threshold_lvt(unsigned long lvt_off)
 
 void smp_local_timer_interrupt(struct pt_regs *regs)
 {
-       int cpu = smp_processor_id();
-
        profile_tick(CPU_PROFILING, regs);
-       if (--per_cpu(prof_counter, cpu) <= 0) {
-               /*
-                * The multiplier may have changed since the last time we got
-                * to this point as a result of the user writing to
-                * /proc/profile. In this case we need to adjust the APIC
-                * timer accordingly.
-                *
-                * Interrupts are already masked off at this point.
-                */
-               per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
-               if (per_cpu(prof_counter, cpu) != 
-                   per_cpu(prof_old_multiplier, cpu)) {
-                       __setup_APIC_LVTT(calibration_result/
-                                       per_cpu(prof_counter, cpu));
-                       per_cpu(prof_old_multiplier, cpu) =
-                               per_cpu(prof_counter, cpu);
-               }
-
 #ifdef CONFIG_SMP
-               update_process_times(user_mode(regs));
+       update_process_times(user_mode(regs));
 #endif
-       }
-
        /*
         * We take the 'long' return path, and there every subsystem
         * grabs the appropriate locks (kernel lock/ irq lock).
@@ -920,6 +912,7 @@ void smp_apic_timer_interrupt(struct pt_regs *regs)
         * Besides, if we don't timer interrupts ignore the global
         * interrupt lock, which is the WrongThing (tm) to do.
         */
+       exit_idle();
        irq_enter();
        smp_local_timer_interrupt(regs);
        irq_exit();
@@ -979,6 +972,7 @@ __init int oem_force_hpet_timer(void)
 asmlinkage void smp_spurious_interrupt(void)
 {
        unsigned int v;
+       exit_idle();
        irq_enter();
        /*
         * Check if this really is a spurious interrupt and ACK it
@@ -1014,6 +1008,7 @@ asmlinkage void smp_error_interrupt(void)
 {
        unsigned int v, v1;
 
+       exit_idle();
        irq_enter();
        /* First tickle the hardware, only then report what went on. -- REW */
        v = apic_read(APIC_ESR);
@@ -1060,7 +1055,7 @@ int __init APIC_init_uniprocessor (void)
        connect_bsp_APIC();
 
        phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
-       apic_write_around(APIC_ID, boot_cpu_id);
+       apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id));
 
        setup_local_APIC();
 
index aaa6d383351798dca10eb8f7402a5c90a0ac1f95..cfb4f9cebea4d7e9670a1131ee60055216292650 100644 (file)
@@ -33,6 +33,7 @@ int main(void)
        ENTRY(flags);
        ENTRY(addr_limit);
        ENTRY(preempt_count);
+       ENTRY(status);
        BLANK();
 #undef ENTRY
 #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
@@ -64,5 +65,9 @@ int main(void)
        DEFINE(pbe_address, offsetof(struct pbe, address));
        DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
        DEFINE(pbe_next, offsetof(struct pbe, next));
+       BLANK();
+#if DEBUG_STKSZ > EXCEPTION_STKSZ
+       DEFINE(DEBUG_IST, DEBUG_STACK);
+#endif
        return 0;
 }
index 9cd968dd0f5a4bd3b9d4b83525f94ee5386fec14..6dffb498ccd7e4fc36fde19db33c51190c269ab7 100644 (file)
@@ -216,7 +216,7 @@ void early_printk(const char *fmt, ...)
        va_end(ap); 
 } 
 
-static int keep_early; 
+static int __initdata keep_early;
 
 int __init setup_early_printk(char *opt) 
 {  
@@ -226,8 +226,6 @@ int __init setup_early_printk(char *opt)
        if (early_console_initialized)
                return -1;
 
-       opt = strchr(opt, '=') + 1;
-
        strlcpy(buf,opt,sizeof(buf)); 
        space = strchr(buf, ' '); 
        if (space)
index 9ff42041bb6b8b974a00be6c234bbaac31b3213e..632fc0f59fccc23a70ff6c8e4b891e4f6ba96b88 100644 (file)
@@ -313,6 +313,7 @@ int_with_check:
        movl threadinfo_flags(%rcx),%edx
        andl %edi,%edx
        jnz   int_careful
+       andl    $~TS_COMPAT,threadinfo_status(%rcx)
        jmp   retint_swapgs
 
        /* Either reschedule or signal or syscall exit tracking needed. */
@@ -673,7 +674,10 @@ ENTRY(spurious_interrupt)
 
        /* error code is on the stack already */
        /* handle NMI like exceptions that can happen everywhere */
-       .macro paranoidentry sym
+#ifndef DEBUG_IST
+# define DEBUG_IST 0
+#endif
+       .macro paranoidentry sym, ist=0
        SAVE_ALL
        cld
        movl $1,%ebx
@@ -683,10 +687,20 @@ ENTRY(spurious_interrupt)
        js    1f
        swapgs
        xorl  %ebx,%ebx
-1:     movq %rsp,%rdi
+1:
+       .if \ist
+       movq    %gs:pda_data_offset, %rbp
+       .endif
+       movq %rsp,%rdi
        movq ORIG_RAX(%rsp),%rsi
        movq $-1,ORIG_RAX(%rsp)
+       .if \ist
+       subq    $EXCEPTION_STACK_SIZE, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
+       .endif
        call \sym
+       .if \ist
+       addq    $EXCEPTION_STACK_SIZE, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
+       .endif
        cli
        .endm
        
@@ -754,7 +768,7 @@ error_exit:
        jnz  retint_careful
        swapgs 
        RESTORE_ARGS 0,8,0                                              
-       iretq
+       jmp iret_label
        CFI_ENDPROC
 
 error_kernelspace:
@@ -904,7 +918,7 @@ KPROBE_ENTRY(debug)
        INTR_FRAME
        pushq $0
        CFI_ADJUST_CFA_OFFSET 8         
-       paranoidentry do_debug
+       paranoidentry do_debug, DEBUG_IST
        jmp paranoid_exit
        CFI_ENDPROC
        .previous .text
@@ -959,7 +973,12 @@ paranoid_schedule:
        CFI_ENDPROC
 
 KPROBE_ENTRY(int3)
-       zeroentry do_int3       
+       INTR_FRAME
+       pushq $0
+       CFI_ADJUST_CFA_OFFSET 8
+       paranoidentry do_int3, DEBUG_IST
+       jmp paranoid_exit
+       CFI_ENDPROC
        .previous .text
 
 ENTRY(overflow)
@@ -1021,23 +1040,18 @@ ENTRY(machine_check)
        CFI_ENDPROC
 #endif
 
-ENTRY(call_debug)
-       zeroentry do_call_debug
-
 ENTRY(call_softirq)
        CFI_STARTPROC
        movq %gs:pda_irqstackptr,%rax
-       pushq %r15
-       CFI_ADJUST_CFA_OFFSET 8
-       movq %rsp,%r15
-       CFI_DEF_CFA_REGISTER    r15
+       movq %rsp,%rdx
+       CFI_DEF_CFA_REGISTER    rdx
        incl %gs:pda_irqcount
        cmove %rax,%rsp
+       pushq %rdx
+       /*todo CFI_DEF_CFA_EXPRESSION ...*/
        call __do_softirq
-       movq %r15,%rsp
+       popq %rsp
        CFI_DEF_CFA_REGISTER    rsp
        decl %gs:pda_irqcount
-       popq %r15
-       CFI_ADJUST_CFA_OFFSET -8
        ret
        CFI_ENDPROC
index a472d62f899a87a8037a737663c09c3f507bbd77..43fcf62fef0f5aa0931930b1881cc88f7b50605c 100644 (file)
@@ -72,14 +72,11 @@ static void cluster_send_IPI_mask(cpumask_t mask, int vector)
 static void cluster_send_IPI_allbutself(int vector)
 {
        cpumask_t mask = cpu_online_map;
-       int me = get_cpu(); /* Ensure we are not preempted when we clear */
 
-       cpu_clear(me, mask);
+       cpu_clear(smp_processor_id(), mask);
 
        if (!cpus_empty(mask))
                cluster_send_IPI_mask(mask, vector);
-
-       put_cpu();
 }
 
 static void cluster_send_IPI_all(int vector)
index 9da3edb799ea543042776664db789a59b7418163..1a2ab825be98a3ef1dd28840f5ae16b8e6e49740 100644 (file)
@@ -83,12 +83,11 @@ static void flat_send_IPI_allbutself(int vector)
                __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL);
 #else
        cpumask_t allbutme = cpu_online_map;
-       int me = get_cpu(); /* Ensure we are not preempted when we clear */
-       cpu_clear(me, allbutme);
+
+       cpu_clear(smp_processor_id(), allbutme);
 
        if (!cpus_empty(allbutme))
                flat_send_IPI_mask(allbutme, vector);
-       put_cpu();
 #endif
 }
 
@@ -149,10 +148,9 @@ static void physflat_send_IPI_mask(cpumask_t cpumask, int vector)
 static void physflat_send_IPI_allbutself(int vector)
 {
        cpumask_t allbutme = cpu_online_map;
-       int me = get_cpu();
-       cpu_clear(me, allbutme);
+
+       cpu_clear(smp_processor_id(), allbutme);
        physflat_send_IPI_mask(allbutme, vector);
-       put_cpu();
 }
 
 static void physflat_send_IPI_all(int vector)
index 15290968e49db562753b720f15b9d564500f5668..38fc3d5112e77cfbd66df249227440c6fa66edf1 100644 (file)
@@ -379,14 +379,14 @@ gdt:
  * Also sysret mandates a special GDT layout 
  */
                                
-.align L1_CACHE_BYTES
+.align PAGE_SIZE
 
 /* The TLS descriptors are currently at a different place compared to i386.
    Hopefully nobody expects them at a fixed place (Wine?) */
        
 ENTRY(cpu_gdt_table)
        .quad   0x0000000000000000      /* NULL descriptor */
-       .quad   0x008f9a000000ffff      /* __KERNEL_COMPAT32_CS */      
+       .quad   0x0                     /* unused */
        .quad   0x00af9a000000ffff      /* __KERNEL_CS */
        .quad   0x00cf92000000ffff      /* __KERNEL_DS */
        .quad   0x00cffa000000ffff      /* __USER32_CS */
@@ -396,15 +396,15 @@ ENTRY(cpu_gdt_table)
        .quad   0,0                     /* TSS */
        .quad   0,0                     /* LDT */
        .quad   0,0,0                   /* three TLS descriptors */ 
-       .quad   0x00009a000000ffff      /* __KERNEL16_CS - 16bit PM for S3 wakeup. */
-                                       /* base must be patched for real base address. */
+       .quad   0                       /* unused */
 gdt_end:       
        /* asm/segment.h:GDT_ENTRIES must match this */ 
        /* This should be a multiple of the cache line size */
-       /* GDTs of other CPUs: */       
-       .fill (GDT_SIZE * NR_CPUS) - (gdt_end - cpu_gdt_table)
+       /* GDTs of other CPUs are now dynamically allocated */
+
+       /* zero the remaining page */
+       .fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
 
-       .align  L1_CACHE_BYTES
 ENTRY(idt_table)       
        .rept   256
        .quad   0
index b675c5add01ece1b5b9071940e25d0b714e4f536..cea20a66c150b38250477d870e170a059d1942a6 100644 (file)
@@ -92,6 +92,9 @@ void __init x86_64_start_kernel(char * real_mode_data)
        memcpy(init_level4_pgt, boot_level4_pgt, PTRS_PER_PGD*sizeof(pgd_t));
        asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt)));
 
+       for (i = 0; i < NR_CPUS; i++)
+               cpu_pda(i) = &boot_cpu_pda[i];
+
        pda_init(0);
        copy_bootdata(real_mode_data);
 #ifdef CONFIG_SMP
@@ -99,7 +102,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
 #endif
        s = strstr(saved_command_line, "earlyprintk=");
        if (s != NULL)
-               setup_early_printk(s);
+               setup_early_printk(strchr(s, '=') + 1);
 #ifdef CONFIG_NUMA
        s = strstr(saved_command_line, "numa=");
        if (s != NULL)
index d9b22b633e390c0739fdd33ba64b121982b8925f..a5d7e16b928ebc62dc9ba26a9215e30da63b9ad4 100644 (file)
@@ -95,7 +95,7 @@ int save_i387(struct _fpstate __user *buf)
        if (!used_math())
                return 0;
        clear_used_math(); /* trigger finit */
-       if (tsk->thread_info->status & TS_USEDFPU) {
+       if (task_thread_info(tsk)->status & TS_USEDFPU) {
                err = save_i387_checking((struct i387_fxsave_struct __user *)buf);
                if (err) return err;
                stts();
index 6e5101ad3d1a075290e3acb298b78e0f5e430c8d..5ecd34ab8c2bba9ae70d15ff9803ead2957c72d9 100644 (file)
@@ -133,7 +133,7 @@ static void end_8259A_irq (unsigned int irq)
 {
        if (irq > 256) { 
                char var;
-               printk("return %p stack %p ti %p\n", __builtin_return_address(0), &var, current->thread_info); 
+               printk("return %p stack %p ti %p\n", __builtin_return_address(0), &var, task_thread_info(current));
 
                BUG(); 
        }
@@ -549,10 +549,9 @@ void __init init_IRQ(void)
                int vector = FIRST_EXTERNAL_VECTOR + i;
                if (i >= NR_IRQS)
                        break;
-               if (vector != IA32_SYSCALL_VECTOR && vector != KDB_VECTOR) { 
+               if (vector != IA32_SYSCALL_VECTOR)
                        set_intr_gate(vector, interrupt[i]);
        }
-       }
 
 #ifdef CONFIG_SMP
        /*
index 97154ab058b470e1e27af7484e6adcf97fa93a06..e8cf44ef8778dc50adc3d71a92ba7665155da7ff 100644 (file)
@@ -37,6 +37,7 @@
 #include <asm/proto.h>
 #include <asm/mach_apic.h>
 #include <asm/acpi.h>
+#include <asm/dma.h>
 
 #define __apicdebuginit  __init
 
@@ -46,6 +47,9 @@ static int no_timer_check;
 
 int disable_timer_pin_1 __initdata;
 
+/* Where if anywhere is the i8259 connect in external int mode */
+static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
+
 static DEFINE_SPINLOCK(ioapic_lock);
 
 /*
@@ -260,9 +264,6 @@ __setup("apic", enable_ioapic_setup);
 void __init check_ioapic(void) 
 { 
        int num,slot,func; 
-       if (ioapic_force) 
-               return; 
-
        /* Poor man's PCI discovery */
        for (num = 0; num < 32; num++) { 
                for (slot = 0; slot < 32; slot++) { 
@@ -284,7 +285,7 @@ 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 > MAX_DMA32_PFN ||
                                             force_iommu) &&
                                            !iommu_aperture_allowed) {
                                                printk(KERN_INFO
@@ -363,7 +364,7 @@ static int find_irq_entry(int apic, int pin, int type)
 /*
  * Find the pin to which IRQ[irq] (ISA) is connected
  */
-static int find_isa_irq_pin(int irq, int type)
+static int __init find_isa_irq_pin(int irq, int type)
 {
        int i;
 
@@ -381,6 +382,31 @@ static int find_isa_irq_pin(int irq, int type)
        return -1;
 }
 
+static int __init find_isa_irq_apic(int irq, int type)
+{
+       int i;
+
+       for (i = 0; i < mp_irq_entries; i++) {
+               int lbus = mp_irqs[i].mpc_srcbus;
+
+               if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA ||
+                    mp_bus_id_to_type[lbus] == MP_BUS_EISA ||
+                    mp_bus_id_to_type[lbus] == MP_BUS_MCA) &&
+                   (mp_irqs[i].mpc_irqtype == type) &&
+                   (mp_irqs[i].mpc_srcbusirq == irq))
+                       break;
+       }
+       if (i < mp_irq_entries) {
+               int apic;
+               for(apic = 0; apic < nr_ioapics; apic++) {
+                       if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic)
+                               return apic;
+               }
+       }
+
+       return -1;
+}
+
 /*
  * Find a specific PCI IRQ entry.
  * Not an __init, possibly needed by modules
@@ -874,7 +900,7 @@ static void __init setup_IO_APIC_irqs(void)
  * Set up the 8259A-master output pin as broadcast to all
  * CPUs.
  */
-static void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector)
+static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, int vector)
 {
        struct IO_APIC_route_entry entry;
        unsigned long flags;
@@ -884,7 +910,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector)
        disable_8259A_irq(0);
 
        /* mask LVT0 */
-       apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
+       apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
 
        /*
         * We use logical delivery to get the timer IRQ
@@ -908,8 +934,8 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector)
         * Add it to the IO-APIC irq-routing table:
         */
        spin_lock_irqsave(&ioapic_lock, flags);
-       io_apic_write(0, 0x11+2*pin, *(((int *)&entry)+1));
-       io_apic_write(0, 0x10+2*pin, *(((int *)&entry)+0));
+       io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1));
+       io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0));
        spin_unlock_irqrestore(&ioapic_lock, flags);
 
        enable_8259A_irq(0);
@@ -1188,7 +1214,8 @@ void __apicdebuginit print_PIC(void)
 static void __init enable_IO_APIC(void)
 {
        union IO_APIC_reg_01 reg_01;
-       int i;
+       int i8259_apic, i8259_pin;
+       int i, apic;
        unsigned long flags;
 
        for (i = 0; i < PIN_MAP_SIZE; i++) {
@@ -1202,11 +1229,48 @@ static void __init enable_IO_APIC(void)
        /*
         * The number of IO-APIC IRQ registers (== #pins):
         */
-       for (i = 0; i < nr_ioapics; i++) {
+       for (apic = 0; apic < nr_ioapics; apic++) {
                spin_lock_irqsave(&ioapic_lock, flags);
-               reg_01.raw = io_apic_read(i, 1);
+               reg_01.raw = io_apic_read(apic, 1);
                spin_unlock_irqrestore(&ioapic_lock, flags);
-               nr_ioapic_registers[i] = reg_01.bits.entries+1;
+               nr_ioapic_registers[apic] = reg_01.bits.entries+1;
+       }
+       for(apic = 0; apic < nr_ioapics; apic++) {
+               int pin;
+               /* See if any of the pins is in ExtINT mode */
+               for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
+                       struct IO_APIC_route_entry entry;
+                       spin_lock_irqsave(&ioapic_lock, flags);
+                       *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
+                       *(((int *)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin);
+                       spin_unlock_irqrestore(&ioapic_lock, flags);
+
+
+                       /* If the interrupt line is enabled and in ExtInt mode
+                        * I have found the pin where the i8259 is connected.
+                        */
+                       if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) {
+                               ioapic_i8259.apic = apic;
+                               ioapic_i8259.pin  = pin;
+                               goto found_i8259;
+                       }
+               }
+       }
+ found_i8259:
+       /* Look to see what if the MP table has reported the ExtINT */
+       i8259_pin  = find_isa_irq_pin(0, mp_ExtINT);
+       i8259_apic = find_isa_irq_apic(0, mp_ExtINT);
+       /* Trust the MP table if nothing is setup in the hardware */
+       if ((ioapic_i8259.pin == -1) && (i8259_pin >= 0)) {
+               printk(KERN_WARNING "ExtINT not setup in hardware but reported by MP table\n");
+               ioapic_i8259.pin  = i8259_pin;
+               ioapic_i8259.apic = i8259_apic;
+       }
+       /* Complain if the MP table and the hardware disagree */
+       if (((ioapic_i8259.apic != i8259_apic) || (ioapic_i8259.pin != i8259_pin)) &&
+               (i8259_pin >= 0) && (ioapic_i8259.pin >= 0))
+       {
+               printk(KERN_WARNING "ExtINT in hardware and MP table differ\n");
        }
 
        /*
@@ -1220,7 +1284,6 @@ static void __init enable_IO_APIC(void)
  */
 void disable_IO_APIC(void)
 {
-       int pin;
        /*
         * Clear the IO-APIC before rebooting:
         */
@@ -1231,8 +1294,7 @@ void disable_IO_APIC(void)
         * Put that IOAPIC in virtual wire mode
         * so legacy interrupts can be delivered.
         */
-       pin = find_isa_irq_pin(0, mp_ExtINT);
-       if (pin != -1) {
+       if (ioapic_i8259.pin != -1) {
                struct IO_APIC_route_entry entry;
                unsigned long flags;
 
@@ -1243,21 +1305,23 @@ void disable_IO_APIC(void)
                entry.polarity        = 0; /* High */
                entry.delivery_status = 0;
                entry.dest_mode       = 0; /* Physical */
-               entry.delivery_mode   = 7; /* ExtInt */
+               entry.delivery_mode   = dest_ExtINT; /* ExtInt */
                entry.vector          = 0;
-               entry.dest.physical.physical_dest = 0;
-
+               entry.dest.physical.physical_dest =
+                                       GET_APIC_ID(apic_read(APIC_ID));
 
                /*
                 * Add it to the IO-APIC irq-routing table:
                 */
                spin_lock_irqsave(&ioapic_lock, flags);
-               io_apic_write(0, 0x11+2*pin, *(((int *)&entry)+1));
-               io_apic_write(0, 0x10+2*pin, *(((int *)&entry)+0));
+               io_apic_write(ioapic_i8259.apic, 0x11+2*ioapic_i8259.pin,
+                       *(((int *)&entry)+1));
+               io_apic_write(ioapic_i8259.apic, 0x10+2*ioapic_i8259.pin,
+                       *(((int *)&entry)+0));
                spin_unlock_irqrestore(&ioapic_lock, flags);
        }
 
-       disconnect_bsp_APIC(pin != -1);
+       disconnect_bsp_APIC(ioapic_i8259.pin != -1);
 }
 
 /*
@@ -1571,7 +1635,7 @@ static void enable_lapic_irq (unsigned int irq)
        unsigned long v;
 
        v = apic_read(APIC_LVT0);
-       apic_write_around(APIC_LVT0, v & ~APIC_LVT_MASKED);
+       apic_write(APIC_LVT0, v & ~APIC_LVT_MASKED);
 }
 
 static void disable_lapic_irq (unsigned int irq)
@@ -1579,7 +1643,7 @@ static void disable_lapic_irq (unsigned int irq)
        unsigned long v;
 
        v = apic_read(APIC_LVT0);
-       apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED);
+       apic_write(APIC_LVT0, v | APIC_LVT_MASKED);
 }
 
 static void ack_lapic_irq (unsigned int irq)
@@ -1626,20 +1690,21 @@ static void setup_nmi (void)
  */
 static inline void unlock_ExtINT_logic(void)
 {
-       int pin, i;
+       int apic, pin, i;
        struct IO_APIC_route_entry entry0, entry1;
        unsigned char save_control, save_freq_select;
        unsigned long flags;
 
-       pin = find_isa_irq_pin(8, mp_INT);
+       pin  = find_isa_irq_pin(8, mp_INT);
+       apic = find_isa_irq_apic(8, mp_INT);
        if (pin == -1)
                return;
 
        spin_lock_irqsave(&ioapic_lock, flags);
-       *(((int *)&entry0) + 1) = io_apic_read(0, 0x11 + 2 * pin);
-       *(((int *)&entry0) + 0) = io_apic_read(0, 0x10 + 2 * pin);
+       *(((int *)&entry0) + 1) = io_apic_read(apic, 0x11 + 2 * pin);
+       *(((int *)&entry0) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
        spin_unlock_irqrestore(&ioapic_lock, flags);
-       clear_IO_APIC_pin(0, pin);
+       clear_IO_APIC_pin(apic, pin);
 
        memset(&entry1, 0, sizeof(entry1));
 
@@ -1652,8 +1717,8 @@ static inline void unlock_ExtINT_logic(void)
        entry1.vector = 0;
 
        spin_lock_irqsave(&ioapic_lock, flags);
-       io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry1) + 1));
-       io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry1) + 0));
+       io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry1) + 1));
+       io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry1) + 0));
        spin_unlock_irqrestore(&ioapic_lock, flags);
 
        save_control = CMOS_READ(RTC_CONTROL);
@@ -1671,11 +1736,11 @@ static inline void unlock_ExtINT_logic(void)
 
        CMOS_WRITE(save_control, RTC_CONTROL);
        CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
-       clear_IO_APIC_pin(0, pin);
+       clear_IO_APIC_pin(apic, pin);
 
        spin_lock_irqsave(&ioapic_lock, flags);
-       io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry0) + 1));
-       io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry0) + 0));
+       io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry0) + 1));
+       io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry0) + 0));
        spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
@@ -1687,7 +1752,7 @@ static inline void unlock_ExtINT_logic(void)
  */
 static inline void check_timer(void)
 {
-       int pin1, pin2;
+       int apic1, pin1, apic2, pin2;
        int vector;
 
        /*
@@ -1704,14 +1769,17 @@ static inline void check_timer(void)
         * the 8259A which implies the virtual wire has to be
         * disabled in the local APIC.
         */
-       apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
+       apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
        init_8259A(1);
        enable_8259A_irq(0);
 
-       pin1 = find_isa_irq_pin(0, mp_INT);
-       pin2 = find_isa_irq_pin(0, mp_ExtINT);
+       pin1  = find_isa_irq_pin(0, mp_INT);
+       apic1 = find_isa_irq_apic(0, mp_INT);
+       pin2  = ioapic_i8259.pin;
+       apic2 = ioapic_i8259.apic;
 
-       apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X pin1=%d pin2=%d\n", vector, pin1, pin2);
+       apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
+               vector, apic1, pin1, apic2, pin2);
 
        if (pin1 != -1) {
                /*
@@ -1729,17 +1797,20 @@ static inline void check_timer(void)
                                clear_IO_APIC_pin(0, pin1);
                        return;
                }
-               clear_IO_APIC_pin(0, pin1);
-               apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n");
+               clear_IO_APIC_pin(apic1, pin1);
+               apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not "
+                               "connected to IO-APIC\n");
        }
 
-       apic_printk(APIC_VERBOSE,KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... ");
+       apic_printk(APIC_VERBOSE,KERN_INFO "...trying to set up timer (IRQ0) "
+                               "through the 8259A ... ");
        if (pin2 != -1) {
-               apic_printk(APIC_VERBOSE,"\n..... (found pin %d) ...", pin2);
+               apic_printk(APIC_VERBOSE,"\n..... (found apic %d pin %d) ...",
+                       apic2, pin2);
                /*
                 * legacy devices should be connected to IO APIC #0
                 */
-               setup_ExtINT_IRQ0_pin(pin2, vector);
+               setup_ExtINT_IRQ0_pin(apic2, pin2, vector);
                if (timer_irq_works()) {
                        printk("works.\n");
                        nmi_watchdog_default();
@@ -1751,7 +1822,7 @@ static inline void check_timer(void)
                /*
                 * Cleanup, just in case ...
                 */
-               clear_IO_APIC_pin(0, pin2);
+               clear_IO_APIC_pin(apic2, pin2);
        }
        printk(" failed.\n");
 
@@ -1764,21 +1835,21 @@ static inline void check_timer(void)
 
        disable_8259A_irq(0);
        irq_desc[0].handler = &lapic_irq_type;
-       apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector);   /* Fixed mode */
+       apic_write(APIC_LVT0, APIC_DM_FIXED | vector);  /* Fixed mode */
        enable_8259A_irq(0);
 
        if (timer_irq_works()) {
                apic_printk(APIC_QUIET, " works.\n");
                return;
        }
-       apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
+       apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
        apic_printk(APIC_VERBOSE," failed.\n");
 
        apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ...");
 
        init_8259A(0);
        make_8259A_irq(0);
-       apic_write_around(APIC_LVT0, APIC_DM_EXTINT);
+       apic_write(APIC_LVT0, APIC_DM_EXTINT);
 
        unlock_ExtINT_logic();
 
index cde0e868efe321c5daadab3aae7684cb4bfb587e..b81614970ecce60315ab9ea10c65c9d4562f253f 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/sched.h>
 #include <linux/kernel.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/ioport.h>
index d6a04a8320a38d475a3780488b856ecba23fe66b..30d2a1e545fea1fda11f9010ffd25d67854e8baa 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/delay.h>
 #include <asm/uaccess.h>
 #include <asm/io_apic.h>
+#include <asm/idle.h>
 
 atomic_t irq_err_count;
 #ifdef CONFIG_X86_IO_APIC
@@ -69,13 +70,13 @@ skip:
                seq_printf(p, "NMI: ");
                for (j = 0; j < NR_CPUS; j++)
                        if (cpu_online(j))
-                               seq_printf(p, "%10u ", cpu_pda[j].__nmi_count);
+                               seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count);
                seq_putc(p, '\n');
 #ifdef CONFIG_X86_LOCAL_APIC
                seq_printf(p, "LOC: ");
                for (j = 0; j < NR_CPUS; j++)
                        if (cpu_online(j))
-                               seq_printf(p, "%10u ", cpu_pda[j].apic_timer_irqs);
+                               seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs);
                seq_putc(p, '\n');
 #endif
                seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
@@ -98,6 +99,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
        /* high bits used in ret_from_ code  */
        unsigned irq = regs->orig_rax & 0xff;
 
+       exit_idle();
        irq_enter();
 
        __do_IRQ(irq, regs);
index b7dc1f816d13e616dacced97857994f42000ee47..8b866a8572cfab92546ff539b185799d695c07dc 100644 (file)
@@ -334,6 +334,15 @@ int __kprobes kprobe_handler(struct pt_regs *regs)
                                return 1;
                        }
                } else {
+                       if (*addr != BREAKPOINT_INSTRUCTION) {
+                       /* The breakpoint instruction was removed by
+                        * another cpu right after we hit, no further
+                        * handling of this interrupt is appropriate
+                        */
+                               regs->rip = (unsigned long)addr;
+                               ret = 1;
+                               goto no_kprobe;
+                       }
                        p = __get_cpu_var(current_kprobe);
                        if (p->break_handler && p->break_handler(p, regs)) {
                                goto ss_probe;
index 183dc61054295426fcf12262cf94c66ab6df0a0b..13a2eada6c9520e2e32d38e278f6e57e8c06cd53 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/sysdev.h>
 #include <linux/miscdevice.h>
 #include <linux/fs.h>
+#include <linux/capability.h>
 #include <linux/cpu.h>
 #include <linux/percpu.h>
 #include <linux/ctype.h>
 #include <asm/mce.h>
 #include <asm/kdebug.h>
 #include <asm/uaccess.h>
+#include <asm/smp.h>
 
 #define MISC_MCELOG_MINOR 227
-#define NR_BANKS 5
+#define NR_BANKS 6
 
 static int mce_dont_init;
 
@@ -91,6 +93,7 @@ void mce_log(struct mce *mce)
 static void print_mce(struct mce *m)
 {
        printk(KERN_EMERG "\n"
+              KERN_EMERG "HARDWARE ERROR\n"
               KERN_EMERG
               "CPU %d: Machine Check Exception: %16Lx Bank %d: %016Lx\n",
               m->cpu, m->mcgstatus, m->bank, m->status);
@@ -109,6 +112,9 @@ static void print_mce(struct mce *m)
        if (m->misc)
                printk("MISC %Lx ", m->misc);   
        printk("\n");
+       printk(KERN_EMERG "This is not a software problem!\n");
+        printk(KERN_EMERG
+    "Run through mcelog --ascii to decode and contact your hardware vendor\n");
 }
 
 static void mce_panic(char *msg, struct mce *backup, unsigned long start)
@@ -168,12 +174,12 @@ void do_machine_check(struct pt_regs * regs, long error_code)
        int panicm_found = 0;
 
        if (regs)
-               notify_die(DIE_NMI, "machine check", regs, error_code, 255, SIGKILL);
+               notify_die(DIE_NMI, "machine check", regs, error_code, 18, SIGKILL);
        if (!banks)
                return;
 
        memset(&m, 0, sizeof(struct mce));
-       m.cpu = hard_smp_processor_id();
+       m.cpu = safe_smp_processor_id();
        rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus);
        if (!(m.mcgstatus & MCG_STATUS_RIPV))
                kill_it = 1;
@@ -573,6 +579,10 @@ ACCESSOR(bank1ctl,bank[1],mce_restart())
 ACCESSOR(bank2ctl,bank[2],mce_restart())
 ACCESSOR(bank3ctl,bank[3],mce_restart())
 ACCESSOR(bank4ctl,bank[4],mce_restart())
+ACCESSOR(bank5ctl,bank[5],mce_restart())
+static struct sysdev_attribute * bank_attributes[NR_BANKS] = {
+       &attr_bank0ctl, &attr_bank1ctl, &attr_bank2ctl,
+       &attr_bank3ctl, &attr_bank4ctl, &attr_bank5ctl};
 ACCESSOR(tolerant,tolerant,)
 ACCESSOR(check_interval,check_interval,mce_restart())
 
@@ -580,6 +590,7 @@ ACCESSOR(check_interval,check_interval,mce_restart())
 static __cpuinit int mce_create_device(unsigned int cpu)
 {
        int err;
+       int i;
        if (!mce_available(&cpu_data[cpu]))
                return -EIO;
 
@@ -589,11 +600,9 @@ static __cpuinit int mce_create_device(unsigned int cpu)
        err = sysdev_register(&per_cpu(device_mce,cpu));
 
        if (!err) {
-               sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank0ctl);
-               sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank1ctl);
-               sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank2ctl);
-               sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank3ctl);
-               sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank4ctl);
+               for (i = 0; i < banks; i++)
+                       sysdev_create_file(&per_cpu(device_mce,cpu),
+                               bank_attributes[i]);
                sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant);
                sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval);
        }
@@ -603,11 +612,11 @@ static __cpuinit int mce_create_device(unsigned int cpu)
 #ifdef CONFIG_HOTPLUG_CPU
 static __cpuinit void mce_remove_device(unsigned int cpu)
 {
-       sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank0ctl);
-       sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank1ctl);
-       sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank2ctl);
-       sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank3ctl);
-       sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank4ctl);
+       int i;
+
+       for (i = 0; i < banks; i++)
+               sysdev_remove_file(&per_cpu(device_mce,cpu),
+                       bank_attributes[i]);
        sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant);
        sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval);
        sysdev_unregister(&per_cpu(device_mce,cpu));
index 1f76175ace028bdef349766fbc165ce712289c22..d3ad7d81266d6e0b55e1ff8d70c7555d122bb27e 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/mce.h>
 #include <asm/msr.h>
 #include <asm/percpu.h>
+#include <asm/idle.h>
 
 #define PFX "mce_threshold: "
 #define VERSION "version 1.00.9"
@@ -140,6 +141,7 @@ asmlinkage void mce_threshold_interrupt(void)
        struct mce m;
 
        ack_APIC_irq();
+       exit_idle();
        irq_enter();
 
        memset(&m, 0, sizeof(m));
@@ -318,7 +320,7 @@ static struct kobj_type threshold_ktype = {
 static __cpuinit int threshold_create_bank(unsigned int cpu, int bank)
 {
        int err = 0;
-       struct threshold_bank *b = 0;
+       struct threshold_bank *b = NULL;
 
 #ifdef CONFIG_SMP
        if (cpu_core_id[cpu] && shared_bank[bank]) {    /* symlink */
@@ -407,7 +409,7 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank)
        if (shared_bank[bank] && atomic_read(&b->kobj.kref.refcount) > 2) {
                sprintf(name, "bank%i", bank);
                sysfs_remove_link(&per_cpu(device_threshold, cpu).kobj, name);
-               per_cpu(threshold_banks, cpu)[bank] = 0;
+               per_cpu(threshold_banks, cpu)[bank] = NULL;
        } else {
                kobject_unregister(&b->kobj);
                kfree(per_cpu(threshold_banks, cpu)[bank]);
index 0be0a795981418750d322dced63743ee97b4e201..8f533d2c40cbdf3e25114206ee85c5362eec74c1 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/msr.h>
 #include <asm/mce.h>
 #include <asm/hw_irq.h>
+#include <asm/idle.h>
 
 static DEFINE_PER_CPU(unsigned long, next_check);
 
@@ -19,6 +20,7 @@ asmlinkage void smp_thermal_interrupt(void)
 
        ack_APIC_irq();
 
+       exit_idle();
        irq_enter();
        if (time_before(jiffies, __get_cpu_var(next_check)))
                goto done;
@@ -78,7 +80,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
 
        h = THERMAL_APIC_VECTOR;
        h |= (APIC_DM_FIXED | APIC_LVT_MASKED);
-       apic_write_around(APIC_LVTTHMR, h);
+       apic_write(APIC_LVTTHMR, h);
 
        rdmsr(MSR_IA32_THERM_INTERRUPT, l, h);
        wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h);
@@ -87,7 +89,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
        wrmsr(MSR_IA32_MISC_ENABLE, l | (1 << 3), h);
 
        l = apic_read(APIC_LVTTHMR);
-       apic_write_around(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
+       apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
        printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n",
                cpu, tm2 ? "TM2" : "TM1");
        return;
index 39d445e16f2254441b29dcfb6a5a37de5439ca8a..5fae6f0cd9947d16cc5530777268c80d36490a0b 100644 (file)
@@ -151,23 +151,25 @@ int __init check_nmi_watchdog (void)
 
        printk(KERN_INFO "testing NMI watchdog ... ");
 
+#ifdef CONFIG_SMP
        if (nmi_watchdog == NMI_LOCAL_APIC)
                smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
+#endif
 
        for (cpu = 0; cpu < NR_CPUS; cpu++)
-               counts[cpu] = cpu_pda[cpu].__nmi_count; 
+               counts[cpu] = cpu_pda(cpu)->__nmi_count;
        local_irq_enable();
        mdelay((10*1000)/nmi_hz); // wait 10 ticks
 
        for (cpu = 0; cpu < NR_CPUS; cpu++) {
                if (!cpu_online(cpu))
                        continue;
-               if (cpu_pda[cpu].__nmi_count - counts[cpu] <= 5) {
+               if (cpu_pda(cpu)->__nmi_count - counts[cpu] <= 5) {
                        endflag = 1;
                        printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n",
                               cpu,
                               counts[cpu],
-                              cpu_pda[cpu].__nmi_count);
+                              cpu_pda(cpu)->__nmi_count);
                        nmi_active = 0;
                        lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG;
                        nmi_perfctr_msr = 0;
index cab471cf3edb33acde2d7516dfb9c326e3aa6b9f..2f5d8328e2b9452b52d3ffe168eea428e8ccc8d8 100644 (file)
 #include <linux/pci.h>
 #include <linux/module.h>
 #include <asm/io.h>
+#include <asm/proto.h>
 
-/* Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scatter-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
+int iommu_merge __read_mostly = 0;
+EXPORT_SYMBOL(iommu_merge);
+
+dma_addr_t bad_dma_address __read_mostly;
+EXPORT_SYMBOL(bad_dma_address);
+
+/* This tells the BIO block layer to assume merging. Default to off
+   because we cannot guarantee merging later. */
+int iommu_bio_merge __read_mostly = 0;
+EXPORT_SYMBOL(iommu_bio_merge);
+
+int iommu_sac_force __read_mostly = 0;
+EXPORT_SYMBOL(iommu_sac_force);
+
+int no_iommu __read_mostly;
+#ifdef CONFIG_IOMMU_DEBUG
+int panic_on_overflow __read_mostly = 1;
+int force_iommu __read_mostly = 1;
+#else
+int panic_on_overflow __read_mostly = 0;
+int force_iommu __read_mostly= 0;
+#endif
+
+/* Dummy device used for NULL arguments (normally ISA). Better would
+   be probably a smaller DMA mask, but this is bug-to-bug compatible
+   to i386. */
+struct device fallback_dev = {
+       .bus_id = "fallback device",
+       .coherent_dma_mask = 0xffffffff,
+       .dma_mask = &fallback_dev.coherent_dma_mask,
+};
+
+/* Allocate DMA memory on node near device */
+noinline static void *
+dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
+{
+       struct page *page;
+       int node;
+       if (dev->bus == &pci_bus_type)
+               node = pcibus_to_node(to_pci_dev(dev)->bus);
+       else
+               node = numa_node_id();
+       page = alloc_pages_node(node, gfp, order);
+       return page ? page_address(page) : NULL;
+}
+
+/*
+ * Allocate memory for a coherent mapping.
  */
-int dma_map_sg(struct device *hwdev, struct scatterlist *sg,
-              int nents, int direction)
+void *
+dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
+                  gfp_t gfp)
 {
-       int i;
-
-       BUG_ON(direction == DMA_NONE);
-       for (i = 0; i < nents; i++ ) {
-               struct scatterlist *s = &sg[i];
-               BUG_ON(!s->page); 
-               s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
-               s->dma_length = s->length;
+       void *memory;
+       unsigned long dma_mask = 0;
+       u64 bus;
+
+       if (!dev)
+               dev = &fallback_dev;
+       dma_mask = dev->coherent_dma_mask;
+       if (dma_mask == 0)
+               dma_mask = 0xffffffff;
+
+       /* Kludge to make it bug-to-bug compatible with i386. i386
+          uses the normal dma_mask for alloc_coherent. */
+       dma_mask &= *dev->dma_mask;
+
+       /* Why <=? Even when the mask is smaller than 4GB it is often
+          larger than 16MB and in this case we have a chance of
+          finding fitting memory in the next higher zone first. If
+          not retry with true GFP_DMA. -AK */
+       if (dma_mask <= 0xffffffff)
+               gfp |= GFP_DMA32;
+
+ again:
+       memory = dma_alloc_pages(dev, gfp, get_order(size));
+       if (memory == NULL)
+               return NULL;
+
+       {
+               int high, mmu;
+               bus = virt_to_bus(memory);
+               high = (bus + size) >= dma_mask;
+               mmu = high;
+               if (force_iommu && !(gfp & GFP_DMA))
+                       mmu = 1;
+               else if (high) {
+                       free_pages((unsigned long)memory,
+                                  get_order(size));
+
+                       /* Don't use the 16MB ZONE_DMA unless absolutely
+                          needed. It's better to use remapping first. */
+                       if (dma_mask < 0xffffffff && !(gfp & GFP_DMA)) {
+                               gfp = (gfp & ~GFP_DMA32) | GFP_DMA;
+                               goto again;
+                       }
+
+                       if (dma_ops->alloc_coherent)
+                               return dma_ops->alloc_coherent(dev, size,
+                                                          dma_handle, gfp);
+                       return NULL;
+               }
+
+               memset(memory, 0, size);
+               if (!mmu) {
+                       *dma_handle = virt_to_bus(memory);
+                       return memory;
+               }
+       }
+
+       if (dma_ops->alloc_coherent) {
+               free_pages((unsigned long)memory, get_order(size));
+               gfp &= ~(GFP_DMA|GFP_DMA32);
+               return dma_ops->alloc_coherent(dev, size, dma_handle, gfp);
+       }
+
+       if (dma_ops->map_simple) {
+               *dma_handle = dma_ops->map_simple(dev, memory,
+                                             size,
+                                             PCI_DMA_BIDIRECTIONAL);
+               if (*dma_handle != bad_dma_address)
+                       return memory;
        }
-       return nents;
-}
 
-EXPORT_SYMBOL(dma_map_sg);
+       if (panic_on_overflow)
+               panic("dma_alloc_coherent: IOMMU overflow by %lu bytes\n",size);
+       free_pages((unsigned long)memory, get_order(size));
+       return NULL;
+}
+EXPORT_SYMBOL(dma_alloc_coherent);
 
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
+/*
+ * Unmap coherent memory.
+ * The caller must ensure that the device has finished accessing the mapping.
  */
-void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-                 int nents, int dir)
+void dma_free_coherent(struct device *dev, size_t size,
+                        void *vaddr, dma_addr_t bus)
+{
+       if (dma_ops->unmap_single)
+               dma_ops->unmap_single(dev, bus, size, 0);
+       free_pages((unsigned long)vaddr, get_order(size));
+}
+EXPORT_SYMBOL(dma_free_coherent);
+
+int dma_supported(struct device *dev, u64 mask)
+{
+       if (dma_ops->dma_supported)
+               return dma_ops->dma_supported(dev, mask);
+
+       /* Copied from i386. Doesn't make much sense, because it will
+          only work for pci_alloc_coherent.
+          The caller just has to use GFP_DMA in this case. */
+        if (mask < 0x00ffffff)
+                return 0;
+
+       /* Tell the device to use SAC when IOMMU force is on.  This
+          allows the driver to use cheaper accesses in some cases.
+
+          Problem with this is that if we overflow the IOMMU area and
+          return DAC as fallback address the device may not handle it
+          correctly.
+
+          As a special case some controllers have a 39bit address
+          mode that is as efficient as 32bit (aic79xx). Don't force
+          SAC for these.  Assume all masks <= 40 bits are of this
+          type. Normally this doesn't make any difference, but gives
+          more gentle handling of IOMMU overflow. */
+       if (iommu_sac_force && (mask >= 0xffffffffffULL)) {
+               printk(KERN_INFO "%s: Force SAC with mask %Lx\n", dev->bus_id,mask);
+               return 0;
+       }
+
+       return 1;
+}
+EXPORT_SYMBOL(dma_supported);
+
+int dma_set_mask(struct device *dev, u64 mask)
 {
-       int i;
-       for (i = 0; i < nents; i++) { 
-               struct scatterlist *s = &sg[i];
-               BUG_ON(s->page == NULL); 
-               BUG_ON(s->dma_address == 0); 
-               dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
-       } 
+       if (!dev->dma_mask || !dma_supported(dev, mask))
+               return -EIO;
+       *dev->dma_mask = mask;
+       return 0;
 }
+EXPORT_SYMBOL(dma_set_mask);
+
+/* iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge]
+         [,forcesac][,fullflush][,nomerge][,biomerge]
+   size  set size of iommu (in bytes)
+   noagp don't initialize the AGP driver and use full aperture.
+   off   don't use the IOMMU
+   leak  turn on simple iommu leak tracing (only when CONFIG_IOMMU_LEAK is on)
+   memaper[=order] allocate an own aperture over RAM with size 32MB^order.
+   noforce don't force IOMMU usage. Default.
+   force  Force IOMMU.
+   merge  Do lazy merging. This may improve performance on some block devices.
+          Implies force (experimental)
+   biomerge Do merging at the BIO layer. This is more efficient than merge,
+            but should be only done with very big IOMMUs. Implies merge,force.
+   nomerge Don't do SG merging.
+   forcesac For SAC mode for masks <40bits  (experimental)
+   fullflush Flush IOMMU on each allocation (default)
+   nofullflush Don't use IOMMU fullflush
+   allowed  overwrite iommu off workarounds for specific chipsets.
+   soft         Use software bounce buffering (default for Intel machines)
+   noaperture Don't touch the aperture for AGP.
+*/
+__init int iommu_setup(char *p)
+{
+    iommu_merge = 1;
 
-EXPORT_SYMBOL(dma_unmap_sg);
+    while (*p) {
+           if (!strncmp(p,"off",3))
+                   no_iommu = 1;
+           /* gart_parse_options has more force support */
+           if (!strncmp(p,"force",5))
+                   force_iommu = 1;
+           if (!strncmp(p,"noforce",7)) {
+                   iommu_merge = 0;
+                   force_iommu = 0;
+           }
+
+           if (!strncmp(p, "biomerge",8)) {
+                   iommu_bio_merge = 4096;
+                   iommu_merge = 1;
+                   force_iommu = 1;
+           }
+           if (!strncmp(p, "panic",5))
+                   panic_on_overflow = 1;
+           if (!strncmp(p, "nopanic",7))
+                   panic_on_overflow = 0;
+           if (!strncmp(p, "merge",5)) {
+                   iommu_merge = 1;
+                   force_iommu = 1;
+           }
+           if (!strncmp(p, "nomerge",7))
+                   iommu_merge = 0;
+           if (!strncmp(p, "forcesac",8))
+                   iommu_sac_force = 1;
+
+#ifdef CONFIG_SWIOTLB
+           if (!strncmp(p, "soft",4))
+                   swiotlb = 1;
+#endif
+
+#ifdef CONFIG_GART_IOMMU
+           gart_parse_options(p);
+#endif
+
+           p += strcspn(p, ",");
+           if (*p == ',')
+                   ++p;
+    }
+    return 1;
+}
index 2e28e855ec3cff500847957a51251368407fbea3..c37fc7726ba6704a5ff02a2ca6f32463f2420d8d 100644 (file)
@@ -30,8 +30,8 @@
 #include <asm/proto.h>
 #include <asm/cacheflush.h>
 #include <asm/kdebug.h>
-
-dma_addr_t bad_dma_address;
+#include <asm/swiotlb.h>
+#include <asm/dma.h>
 
 unsigned long iommu_bus_base;  /* GART remapping area (physical) */
 static unsigned long iommu_size;       /* size of remapping area bytes */
@@ -39,18 +39,6 @@ static unsigned long iommu_pages;    /* .. and in pages */
 
 u32 *iommu_gatt_base;          /* Remapping table */
 
-int no_iommu; 
-static int no_agp; 
-#ifdef CONFIG_IOMMU_DEBUG
-int panic_on_overflow = 1; 
-int force_iommu = 1;
-#else
-int panic_on_overflow = 0;
-int force_iommu = 0;
-#endif
-int iommu_merge = 1;
-int iommu_sac_force = 0; 
-
 /* If this is disabled the IOMMU will use an optimized flushing strategy
    of only flushing when an mapping is reused. With it true the GART is flushed 
    for every mapping. Problem is that doing the lazy flush seems to trigger
@@ -58,10 +46,6 @@ int iommu_sac_force = 0;
    also seen with Qlogic at least). */
 int iommu_fullflush = 1;
 
-/* This tells the BIO block layer to assume merging. Default to off
-   because we cannot guarantee merging later. */
-int iommu_bio_merge = 0;
-
 #define MAX_NB 8
 
 /* Allocation bitmap for the remapping area */ 
@@ -102,16 +86,6 @@ AGPEXTERN __u32 *agp_gatt_table;
 
 static unsigned long next_bit;  /* protected by iommu_bitmap_lock */
 static int need_flush;                 /* global flush state. set for each gart wrap */
-static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem,
-                              size_t size, int dir, int do_panic);
-
-/* Dummy device used for NULL arguments (normally ISA). Better would
-   be probably a smaller DMA mask, but this is bug-to-bug compatible to i386. */
-static struct device fallback_dev = {
-       .bus_id = "fallback device",
-       .coherent_dma_mask = 0xffffffff,
-       .dma_mask = &fallback_dev.coherent_dma_mask,
-};
 
 static unsigned long alloc_iommu(int size) 
 {      
@@ -185,114 +159,7 @@ static void flush_gart(struct device *dev)
        spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
 } 
 
-/* Allocate DMA memory on node near device */
-noinline
-static void *dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
-{
-       struct page *page;
-       int node;
-       if (dev->bus == &pci_bus_type)
-               node = pcibus_to_node(to_pci_dev(dev)->bus);
-       else
-               node = numa_node_id();
-       page = alloc_pages_node(node, gfp, order);
-       return page ? page_address(page) : NULL;
-}
-
-/* 
- * Allocate memory for a coherent mapping.
- */
-void *
-dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
-                  gfp_t gfp)
-{
-       void *memory;
-       unsigned long dma_mask = 0;
-       u64 bus;
 
-       if (!dev)
-               dev = &fallback_dev;
-       dma_mask = dev->coherent_dma_mask;
-       if (dma_mask == 0) 
-               dma_mask = 0xffffffff; 
-
-       /* Kludge to make it bug-to-bug compatible with i386. i386
-          uses the normal dma_mask for alloc_coherent. */
-       dma_mask &= *dev->dma_mask;
-
-       /* Why <=? Even when the mask is smaller than 4GB it is often larger 
-          than 16MB and in this case we have a chance of finding fitting memory 
-          in the next higher zone first. If not retry with true GFP_DMA. -AK */
-       if (dma_mask <= 0xffffffff)
-               gfp |= GFP_DMA32;
-
- again:
-       memory = dma_alloc_pages(dev, gfp, get_order(size));
-       if (memory == NULL)
-               return NULL;
-
-       {
-               int high, mmu;
-               bus = virt_to_bus(memory);
-               high = (bus + size) >= dma_mask;
-               mmu = high;
-               if (force_iommu && !(gfp & GFP_DMA)) 
-                       mmu = 1;
-               if (no_iommu || dma_mask < 0xffffffffUL) { 
-                       if (high) {
-                               free_pages((unsigned long)memory,
-                                          get_order(size));
-
-                               if (swiotlb) {
-                                       return
-                                       swiotlb_alloc_coherent(dev, size,
-                                                              dma_handle,
-                                                              gfp);
-                               }
-
-                               if (!(gfp & GFP_DMA)) { 
-                                       gfp = (gfp & ~GFP_DMA32) | GFP_DMA;
-                                       goto again;
-                               }
-                               return NULL;
-                       }
-                       mmu = 0; 
-               }       
-               memset(memory, 0, size); 
-               if (!mmu) { 
-                       *dma_handle = virt_to_bus(memory);
-                       return memory;
-               }
-       } 
-
-       *dma_handle = dma_map_area(dev, bus, size, PCI_DMA_BIDIRECTIONAL, 0);
-       if (*dma_handle == bad_dma_address)
-               goto error; 
-       flush_gart(dev);
-       return memory; 
-       
-error:
-       if (panic_on_overflow)
-               panic("dma_alloc_coherent: IOMMU overflow by %lu bytes\n", size);
-       free_pages((unsigned long)memory, get_order(size)); 
-       return NULL; 
-}
-
-/* 
- * Unmap coherent memory.
- * The caller must ensure that the device has finished accessing the mapping.
- */
-void dma_free_coherent(struct device *dev, size_t size,
-                        void *vaddr, dma_addr_t bus)
-{
-       if (swiotlb) {
-               swiotlb_free_coherent(dev, size, vaddr, bus);
-               return;
-       }
-
-       dma_unmap_single(dev, bus, size, 0);
-       free_pages((unsigned long)vaddr, get_order(size));              
-}
 
 #ifdef CONFIG_IOMMU_LEAK
 
@@ -326,7 +193,7 @@ void dump_leak(void)
 #define CLEAR_LEAK(x)
 #endif
 
-static void iommu_full(struct device *dev, size_t size, int dir, int do_panic)
+static void iommu_full(struct device *dev, size_t size, int dir)
 {
        /* 
         * Ran out of IOMMU space for this operation. This is very bad.
@@ -342,11 +209,11 @@ static void iommu_full(struct device *dev, size_t size, int dir, int do_panic)
   "PCI-DMA: Out of IOMMU space for %lu bytes at device %s\n",
               size, dev->bus_id);
 
-       if (size > PAGE_SIZE*EMERGENCY_PAGES && do_panic) {
+       if (size > PAGE_SIZE*EMERGENCY_PAGES) {
                if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL)
                        panic("PCI-DMA: Memory would be corrupted\n");
                if (dir == PCI_DMA_TODEVICE || dir == PCI_DMA_BIDIRECTIONAL) 
-                       panic("PCI-DMA: Random memory would be DMAed\n");
+                       panic(KERN_ERR "PCI-DMA: Random memory would be DMAed\n");
        } 
 
 #ifdef CONFIG_IOMMU_LEAK
@@ -385,8 +252,8 @@ static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t
 /* Map a single continuous physical area into the IOMMU.
  * Caller needs to check if the iommu is needed and flush.
  */
-static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem,
-                               size_t size, int dir, int do_panic)
+static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
+                               size_t size, int dir)
 { 
        unsigned long npages = to_pages(phys_mem, size);
        unsigned long iommu_page = alloc_iommu(npages);
@@ -396,7 +263,7 @@ static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem,
                        return phys_mem; 
                if (panic_on_overflow)
                        panic("dma_map_area overflow %lu bytes\n", size);
-               iommu_full(dev, size, dir, do_panic);
+               iommu_full(dev, size, dir);
                return bad_dma_address;
        }
 
@@ -408,15 +275,21 @@ static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem,
        return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK);
 }
 
+static dma_addr_t gart_map_simple(struct device *dev, char *buf,
+                                size_t size, int dir)
+{
+       dma_addr_t map = dma_map_area(dev, virt_to_bus(buf), size, dir);
+       flush_gart(dev);
+       return map;
+}
+
 /* Map a single area into the IOMMU */
-dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size, int dir)
+dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir)
 {
        unsigned long phys_mem, bus;
 
        BUG_ON(dir == DMA_NONE);
 
-       if (swiotlb)
-               return swiotlb_map_single(dev,addr,size,dir);
        if (!dev)
                dev = &fallback_dev;
 
@@ -424,10 +297,24 @@ dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size, int dir)
        if (!need_iommu(dev, phys_mem, size))
                return phys_mem; 
 
-       bus = dma_map_area(dev, phys_mem, size, dir, 1);
-       flush_gart(dev); 
+       bus = gart_map_simple(dev, addr, size, dir);
        return bus; 
-} 
+}
+
+/*
+ * Wrapper for pci_unmap_single working with scatterlists.
+ */
+void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
+{
+       int i;
+
+       for (i = 0; i < nents; i++) {
+               struct scatterlist *s = &sg[i];
+               if (!s->dma_length || !s->length)
+                       break;
+               dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
+       }
+}
 
 /* Fallback for dma_map_sg in case of overflow */
 static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
@@ -443,10 +330,10 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
                struct scatterlist *s = &sg[i];
                unsigned long addr = page_to_phys(s->page) + s->offset; 
                if (nonforced_iommu(dev, addr, s->length)) { 
-                       addr = dma_map_area(dev, addr, s->length, dir, 0);
+                       addr = dma_map_area(dev, addr, s->length, dir);
                        if (addr == bad_dma_address) { 
                                if (i > 0) 
-                                       dma_unmap_sg(dev, sg, i, dir);
+                                       gart_unmap_sg(dev, sg, i, dir);
                                nents = 0; 
                                sg[0].dma_length = 0;
                                break;
@@ -515,7 +402,7 @@ static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat,
  * DMA map all entries in a scatterlist.
  * Merge chunks that have page aligned sizes into a continuous mapping. 
  */
-int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
+int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
 {
        int i;
        int out;
@@ -527,8 +414,6 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
        if (nents == 0) 
                return 0;
 
-       if (swiotlb)
-               return swiotlb_map_sg(dev,sg,nents,dir);
        if (!dev)
                dev = &fallback_dev;
 
@@ -571,13 +456,13 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
 
 error:
        flush_gart(NULL);
-       dma_unmap_sg(dev, sg, nents, dir);
+       gart_unmap_sg(dev, sg, nents, dir);
        /* When it was forced try again unforced */
        if (force_iommu) 
                return dma_map_sg_nonforce(dev, sg, nents, dir);
        if (panic_on_overflow)
                panic("dma_map_sg: overflow on %lu pages\n", pages);
-       iommu_full(dev, pages << PAGE_SHIFT, dir, 0);
+       iommu_full(dev, pages << PAGE_SHIFT, dir);
        for (i = 0; i < nents; i++)
                sg[i].dma_address = bad_dma_address;
        return 0;
@@ -586,18 +471,13 @@ error:
 /*
  * Free a DMA mapping.
  */ 
-void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
+void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
                      size_t size, int direction)
 {
        unsigned long iommu_page; 
        int npages;
        int i;
 
-       if (swiotlb) {
-               swiotlb_unmap_single(dev,dma_addr,size,direction);
-               return;
-       }
-
        if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE || 
            dma_addr >= iommu_bus_base + iommu_size)
                return;
@@ -610,68 +490,7 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
        free_iommu(iommu_page, npages);
 }
 
-/* 
- * Wrapper for pci_unmap_single working with scatterlists.
- */ 
-void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
-{
-       int i;
-       if (swiotlb) {
-               swiotlb_unmap_sg(dev,sg,nents,dir);
-               return;
-       }
-       for (i = 0; i < nents; i++) { 
-               struct scatterlist *s = &sg[i];
-               if (!s->dma_length || !s->length) 
-                       break;
-               dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
-       }
-}
-
-int dma_supported(struct device *dev, u64 mask)
-{
-       /* Copied from i386. Doesn't make much sense, because it will 
-          only work for pci_alloc_coherent.
-          The caller just has to use GFP_DMA in this case. */
-        if (mask < 0x00ffffff)
-                return 0;
-
-       /* Tell the device to use SAC when IOMMU force is on. 
-          This allows the driver to use cheaper accesses in some cases.
-
-          Problem with this is that if we overflow the IOMMU area
-          and return DAC as fallback address the device may not handle it correctly.
-          
-          As a special case some controllers have a 39bit address mode 
-          that is as efficient as 32bit (aic79xx). Don't force SAC for these.
-          Assume all masks <= 40 bits are of this type. Normally this doesn't
-          make any difference, but gives more gentle handling of IOMMU overflow. */
-       if (iommu_sac_force && (mask >= 0xffffffffffULL)) { 
-               printk(KERN_INFO "%s: Force SAC with mask %Lx\n", dev->bus_id,mask);
-               return 0; 
-       }
-
-       return 1;
-} 
-
-int dma_get_cache_alignment(void)
-{
-       return boot_cpu_data.x86_clflush_size;
-}
-
-EXPORT_SYMBOL(dma_unmap_sg);
-EXPORT_SYMBOL(dma_map_sg);
-EXPORT_SYMBOL(dma_map_single);
-EXPORT_SYMBOL(dma_unmap_single);
-EXPORT_SYMBOL(dma_supported);
-EXPORT_SYMBOL(no_iommu);
-EXPORT_SYMBOL(force_iommu); 
-EXPORT_SYMBOL(bad_dma_address);
-EXPORT_SYMBOL(iommu_bio_merge);
-EXPORT_SYMBOL(iommu_sac_force);
-EXPORT_SYMBOL(dma_get_cache_alignment);
-EXPORT_SYMBOL(dma_alloc_coherent);
-EXPORT_SYMBOL(dma_free_coherent);
+static int no_agp;
 
 static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size)
 { 
@@ -772,12 +591,27 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
  nommu:
        /* Should not happen anymore */
        printk(KERN_ERR "PCI-DMA: More than 4GB of RAM and no IOMMU\n"
-              KERN_ERR "PCI-DMA: 32bit PCI IO may malfunction."); 
+              KERN_ERR "PCI-DMA: 32bit PCI IO may malfunction.\n");
        return -1; 
 } 
 
 extern int agp_amd64_init(void);
 
+static struct dma_mapping_ops gart_dma_ops = {
+       .mapping_error = NULL,
+       .map_single = gart_map_single,
+       .map_simple = gart_map_simple,
+       .unmap_single = gart_unmap_single,
+       .sync_single_for_cpu = NULL,
+       .sync_single_for_device = NULL,
+       .sync_single_range_for_cpu = NULL,
+       .sync_single_range_for_device = NULL,
+       .sync_sg_for_cpu = NULL,
+       .sync_sg_for_device = NULL,
+       .map_sg = gart_map_sg,
+       .unmap_sg = gart_unmap_sg,
+};
+
 static int __init pci_iommu_init(void)
 { 
        struct agp_kern_info info;
@@ -799,16 +633,15 @@ static int __init pci_iommu_init(void)
 
        if (swiotlb) { 
                no_iommu = 1;
-               printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
                return -1; 
        } 
        
        if (no_iommu ||
-           (!force_iommu && end_pfn < 0xffffffff>>PAGE_SHIFT) ||
+           (!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
            !iommu_aperture ||
            (no_agp && init_k8_gatt(&info) < 0)) {
-               printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n"); 
                no_iommu = 1;
+               no_iommu_init();
                return -1;
        }
 
@@ -885,100 +718,50 @@ static int __init pci_iommu_init(void)
                     
        flush_gart(NULL);
 
+       printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
+       dma_ops = &gart_dma_ops;
+
        return 0;
 } 
 
 /* Must execute after PCI subsystem */
 fs_initcall(pci_iommu_init);
 
-/* iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge]
-         [,forcesac][,fullflush][,nomerge][,biomerge]
-   size  set size of iommu (in bytes) 
-   noagp don't initialize the AGP driver and use full aperture.
-   off   don't use the IOMMU
-   leak  turn on simple iommu leak tracing (only when CONFIG_IOMMU_LEAK is on)
-   memaper[=order] allocate an own aperture over RAM with size 32MB^order.  
-   noforce don't force IOMMU usage. Default.
-   force  Force IOMMU.
-   merge  Do lazy merging. This may improve performance on some block devices.
-          Implies force (experimental)
-   biomerge Do merging at the BIO layer. This is more efficient than merge,
-            but should be only done with very big IOMMUs. Implies merge,force.
-   nomerge Don't do SG merging.
-   forcesac For SAC mode for masks <40bits  (experimental)
-   fullflush Flush IOMMU on each allocation (default) 
-   nofullflush Don't use IOMMU fullflush
-   allowed  overwrite iommu off workarounds for specific chipsets.
-   soft         Use software bounce buffering (default for Intel machines)
-   noaperture Don't touch the aperture for AGP.
-*/
-__init int iommu_setup(char *p)
-{ 
-    int arg;
-
-    while (*p) {
-           if (!strncmp(p,"noagp",5))
-                   no_agp = 1;
-           if (!strncmp(p,"off",3))
-                   no_iommu = 1;
-           if (!strncmp(p,"force",5)) {
-                   force_iommu = 1;
-                   iommu_aperture_allowed = 1;
-           }
-           if (!strncmp(p,"allowed",7))
-                   iommu_aperture_allowed = 1;
-           if (!strncmp(p,"noforce",7)) {
-                   iommu_merge = 0;
-                   force_iommu = 0;
-           }
-           if (!strncmp(p, "memaper", 7)) {
-                   fallback_aper_force = 1; 
-                   p += 7; 
-                   if (*p == '=') {
-                           ++p;
-                           if (get_option(&p, &arg))
-                                   fallback_aper_order = arg;
-                   }
-           } 
-           if (!strncmp(p, "biomerge",8)) {
-                   iommu_bio_merge = 4096;
-                   iommu_merge = 1;
-                   force_iommu = 1;
-           }
-           if (!strncmp(p, "panic",5))
-                   panic_on_overflow = 1;
-           if (!strncmp(p, "nopanic",7))
-                   panic_on_overflow = 0;          
-           if (!strncmp(p, "merge",5)) {
-                   iommu_merge = 1;
-                   force_iommu = 1; 
-           }
-           if (!strncmp(p, "nomerge",7))
-                   iommu_merge = 0;
-           if (!strncmp(p, "forcesac",8))
-                   iommu_sac_force = 1;
-           if (!strncmp(p, "fullflush",8))
-                   iommu_fullflush = 1;
-           if (!strncmp(p, "nofullflush",11))
-                   iommu_fullflush = 0;
-           if (!strncmp(p, "soft",4))
-                   swiotlb = 1;
-           if (!strncmp(p, "noaperture",10))
-                   fix_aperture = 0;
+void gart_parse_options(char *p)
+{
+       int arg;
+
 #ifdef CONFIG_IOMMU_LEAK
-           if (!strncmp(p,"leak",4)) {
-                   leak_trace = 1;
-                   p += 4; 
-                   if (*p == '=') ++p;
-                   if (isdigit(*p) && get_option(&p, &arg))
-                           iommu_leak_pages = arg;
-           } else
+       if (!strncmp(p,"leak",4)) {
+               leak_trace = 1;
+               p += 4;
+               if (*p == '=') ++p;
+               if (isdigit(*p) && get_option(&p, &arg))
+                       iommu_leak_pages = arg;
+       }
 #endif
-           if (isdigit(*p) && get_option(&p, &arg)) 
-                   iommu_size = arg;
-           p += strcspn(p, ",");
-           if (*p == ',')
-                   ++p;
-    }
-    return 1;
-} 
+       if (isdigit(*p) && get_option(&p, &arg))
+               iommu_size = arg;
+       if (!strncmp(p, "fullflush",8))
+               iommu_fullflush = 1;
+       if (!strncmp(p, "nofullflush",11))
+               iommu_fullflush = 0;
+       if (!strncmp(p,"noagp",5))
+               no_agp = 1;
+       if (!strncmp(p, "noaperture",10))
+               fix_aperture = 0;
+       /* duplicated from pci-dma.c */
+       if (!strncmp(p,"force",5))
+               iommu_aperture_allowed = 1;
+       if (!strncmp(p,"allowed",7))
+               iommu_aperture_allowed = 1;
+       if (!strncmp(p, "memaper", 7)) {
+               fallback_aper_force = 1;
+               p += 7;
+               if (*p == '=') {
+                       ++p;
+                       if (get_option(&p, &arg))
+                               fallback_aper_order = arg;
+               }
+       }
+}
index 5a981dca87ffb1c6f9abb2bec204d35b7f6903e2..e415649751950d142c6c72c4ba9e2a4bc73a06d7 100644 (file)
@@ -6,89 +6,94 @@
 #include <linux/string.h>
 #include <asm/proto.h>
 #include <asm/processor.h>
+#include <asm/dma.h>
 
-int iommu_merge = 0;
-EXPORT_SYMBOL(iommu_merge);
-
-dma_addr_t bad_dma_address;
-EXPORT_SYMBOL(bad_dma_address);
-
-int iommu_bio_merge = 0;
-EXPORT_SYMBOL(iommu_bio_merge);
-
-int iommu_sac_force = 0;
-EXPORT_SYMBOL(iommu_sac_force);
-
-/* 
- * Dummy IO MMU functions
- */
-
-void *dma_alloc_coherent(struct device *hwdev, size_t size,
-                        dma_addr_t *dma_handle, gfp_t gfp)
+static int
+check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
 {
-       void *ret;
-       u64 mask;
-       int order = get_order(size);
-
-       if (hwdev)
-               mask = hwdev->coherent_dma_mask & *hwdev->dma_mask;
-       else
-               mask = 0xffffffff;
-       for (;;) {
-               ret = (void *)__get_free_pages(gfp, order);
-               if (ret == NULL)
-                       return NULL;
-               *dma_handle = virt_to_bus(ret);
-               if ((*dma_handle & ~mask) == 0)
-                       break;
-               free_pages((unsigned long)ret, order);
-               if (gfp & GFP_DMA)
-                       return NULL;
-               gfp |= GFP_DMA;
+        if (hwdev && bus + size > *hwdev->dma_mask) {
+               printk(KERN_ERR
+                   "nommu_%s: overflow %Lx+%lu of device mask %Lx\n",
+              name, (long long)bus, size, (long long)*hwdev->dma_mask);
+               return 0;
        }
+       return 1;
+}
 
-       memset(ret, 0, size);
-       return ret;
+static dma_addr_t
+nommu_map_single(struct device *hwdev, void *ptr, size_t size,
+              int direction)
+{
+       dma_addr_t bus = virt_to_bus(ptr);
+       if (!check_addr("map_single", hwdev, bus, size))
+                               return bad_dma_address;
+       return bus;
 }
-EXPORT_SYMBOL(dma_alloc_coherent);
 
-void dma_free_coherent(struct device *hwdev, size_t size,
-                        void *vaddr, dma_addr_t dma_handle)
+void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
+                       int direction)
 {
-       free_pages((unsigned long)vaddr, get_order(size));
 }
-EXPORT_SYMBOL(dma_free_coherent);
 
-int dma_supported(struct device *hwdev, u64 mask)
+/* Map a set of buffers described by scatterlist in streaming
+ * mode for DMA.  This is the scatter-gather version of the
+ * above pci_map_single interface.  Here the scatter gather list
+ * elements are each tagged with the appropriate dma address
+ * and length.  They are obtained via sg_dma_{address,length}(SG).
+ *
+ * NOTE: An implementation may be able to use a smaller number of
+ *       DMA address/length pairs than there are SG table elements.
+ *       (for example via virtual mapping capabilities)
+ *       The routine returns the number of addr/length pairs actually
+ *       used, at most nents.
+ *
+ * Device ownership issues as mentioned above for pci_map_single are
+ * the same here.
+ */
+int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
+              int nents, int direction)
 {
-        /*
-         * we fall back to GFP_DMA when the mask isn't all 1s,
-         * so we can't guarantee allocations that must be
-         * within a tighter range than GFP_DMA..
-        * RED-PEN this won't work for pci_map_single. Caller has to
-        * use GFP_DMA in the first place.
-         */
-        if (mask < 0x00ffffff)
-                return 0;
+       int i;
 
-       return 1;
-} 
-EXPORT_SYMBOL(dma_supported);
+       BUG_ON(direction == DMA_NONE);
+       for (i = 0; i < nents; i++ ) {
+               struct scatterlist *s = &sg[i];
+               BUG_ON(!s->page);
+               s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
+               if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
+                       return 0;
+               s->dma_length = s->length;
+       }
+       return nents;
+}
 
-int dma_get_cache_alignment(void)
+/* Unmap a set of streaming mode DMA translations.
+ * Again, cpu read rules concerning calls here are the same as for
+ * pci_unmap_single() above.
+ */
+void nommu_unmap_sg(struct device *dev, struct scatterlist *sg,
+                 int nents, int dir)
 {
-       return boot_cpu_data.x86_clflush_size;
 }
-EXPORT_SYMBOL(dma_get_cache_alignment);
 
-static int __init check_ram(void) 
-{ 
-       if (end_pfn >= 0xffffffff>>PAGE_SHIFT) { 
-               printk(
-               KERN_ERR "WARNING more than 4GB of memory but IOMMU not compiled in.\n"
-               KERN_ERR "WARNING 32bit PCI may malfunction.\n");
-       } 
-       return 0;
-} 
-__initcall(check_ram);
+struct dma_mapping_ops nommu_dma_ops = {
+       .map_single = nommu_map_single,
+       .unmap_single = nommu_unmap_single,
+       .map_sg = nommu_map_sg,
+       .unmap_sg = nommu_unmap_sg,
+       .is_phys = 1,
+};
 
+void __init no_iommu_init(void)
+{
+       if (dma_ops)
+               return;
+       printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n");
+       dma_ops = &nommu_dma_ops;
+       if (end_pfn > MAX_DMA32_PFN) {
+               printk(KERN_ERR
+                      "WARNING more than 4GB of memory but IOMMU not compiled in.\n"
+                      KERN_ERR "WARNING 32bit PCI may malfunction.\n"
+                      KERN_ERR "You might want to enable CONFIG_GART_IOMMU\n");
+       }
+}
diff --git a/arch/x86_64/kernel/pci-swiotlb.c b/arch/x86_64/kernel/pci-swiotlb.c
new file mode 100644 (file)
index 0000000..3569a25
--- /dev/null
@@ -0,0 +1,42 @@
+/* Glue code to lib/swiotlb.c */
+
+#include <linux/pci.h>
+#include <linux/cache.h>
+#include <linux/module.h>
+#include <asm/dma-mapping.h>
+#include <asm/proto.h>
+#include <asm/swiotlb.h>
+#include <asm/dma.h>
+
+int swiotlb __read_mostly;
+EXPORT_SYMBOL(swiotlb);
+
+struct dma_mapping_ops swiotlb_dma_ops = {
+       .mapping_error = swiotlb_dma_mapping_error,
+       .alloc_coherent = swiotlb_alloc_coherent,
+       .free_coherent = swiotlb_free_coherent,
+       .map_single = swiotlb_map_single,
+       .unmap_single = swiotlb_unmap_single,
+       .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
+       .sync_single_for_device = swiotlb_sync_single_for_device,
+       .sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
+       .sync_single_range_for_device = swiotlb_sync_single_range_for_device,
+       .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
+       .sync_sg_for_device = swiotlb_sync_sg_for_device,
+       .map_sg = swiotlb_map_sg,
+       .unmap_sg = swiotlb_unmap_sg,
+       .dma_supported = NULL,
+};
+
+void pci_swiotlb_init(void)
+{
+       /* don't initialize swiotlb if iommu=off (no_iommu=1) */
+       if (!iommu_aperture && !no_iommu &&
+           (end_pfn > MAX_DMA32_PFN || force_iommu))
+              swiotlb = 1;
+       if (swiotlb) {
+               swiotlb_init();
+               printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
+               dma_ops = &swiotlb_dma_ops;
+       }
+}
index 3060ed97b755f836f076c54bee60740ebc41e1be..8ded407e4a9419fd5bcd57dea91e5ef42ad0d41a 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/utsname.h>
 #include <linux/random.h>
 #include <linux/kprobes.h>
+#include <linux/notifier.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/desc.h>
 #include <asm/proto.h>
 #include <asm/ia32.h>
+#include <asm/idle.h>
 
 asmlinkage extern void ret_from_fork(void);
 
 unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED;
 
-static atomic_t hlt_counter = ATOMIC_INIT(0);
-
 unsigned long boot_option_idle_override = 0;
 EXPORT_SYMBOL(boot_option_idle_override);
 
@@ -66,19 +66,49 @@ EXPORT_SYMBOL(boot_option_idle_override);
 void (*pm_idle)(void);
 static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
 
-void disable_hlt(void)
+static struct notifier_block *idle_notifier;
+static DEFINE_SPINLOCK(idle_notifier_lock);
+
+void idle_notifier_register(struct notifier_block *n)
+{
+       unsigned long flags;
+       spin_lock_irqsave(&idle_notifier_lock, flags);
+       notifier_chain_register(&idle_notifier, n);
+       spin_unlock_irqrestore(&idle_notifier_lock, flags);
+}
+EXPORT_SYMBOL_GPL(idle_notifier_register);
+
+void idle_notifier_unregister(struct notifier_block *n)
 {
-       atomic_inc(&hlt_counter);
+       unsigned long flags;
+       spin_lock_irqsave(&idle_notifier_lock, flags);
+       notifier_chain_unregister(&idle_notifier, n);
+       spin_unlock_irqrestore(&idle_notifier_lock, flags);
 }
+EXPORT_SYMBOL(idle_notifier_unregister);
 
-EXPORT_SYMBOL(disable_hlt);
+enum idle_state { CPU_IDLE, CPU_NOT_IDLE };
+static DEFINE_PER_CPU(enum idle_state, idle_state) = CPU_NOT_IDLE;
 
-void enable_hlt(void)
+void enter_idle(void)
 {
-       atomic_dec(&hlt_counter);
+       __get_cpu_var(idle_state) = CPU_IDLE;
+       notifier_call_chain(&idle_notifier, IDLE_START, NULL);
 }
 
-EXPORT_SYMBOL(enable_hlt);
+static void __exit_idle(void)
+{
+       __get_cpu_var(idle_state) = CPU_NOT_IDLE;
+       notifier_call_chain(&idle_notifier, IDLE_END, NULL);
+}
+
+/* Called from interrupts to signify idle end */
+void exit_idle(void)
+{
+       if (current->pid | read_pda(irqcount))
+               return;
+       __exit_idle();
+}
 
 /*
  * We use this if we don't have any better
@@ -88,21 +118,16 @@ void default_idle(void)
 {
        local_irq_enable();
 
-       if (!atomic_read(&hlt_counter)) {
-               clear_thread_flag(TIF_POLLING_NRFLAG);
-               smp_mb__after_clear_bit();
-               while (!need_resched()) {
-                       local_irq_disable();
-                       if (!need_resched())
-                               safe_halt();
-                       else
-                               local_irq_enable();
-               }
-               set_thread_flag(TIF_POLLING_NRFLAG);
-       } else {
-               while (!need_resched())
-                       cpu_relax();
+       clear_thread_flag(TIF_POLLING_NRFLAG);
+       smp_mb__after_clear_bit();
+       while (!need_resched()) {
+               local_irq_disable();
+               if (!need_resched())
+                       safe_halt();
+               else
+                       local_irq_enable();
        }
+       set_thread_flag(TIF_POLLING_NRFLAG);
 }
 
 /*
@@ -201,7 +226,9 @@ void cpu_idle (void)
                                idle = default_idle;
                        if (cpu_is_offline(smp_processor_id()))
                                play_dead();
+                       enter_idle();
                        idle();
+                       __exit_idle();
                }
 
                preempt_enable_no_resched();
@@ -424,7 +451,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp,
        struct task_struct *me = current;
 
        childregs = ((struct pt_regs *)
-                       (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
+                       (THREAD_SIZE + task_stack_page(p))) - 1;
        *childregs = *regs;
 
        childregs->rax = 0;
@@ -436,7 +463,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp,
        p->thread.rsp0 = (unsigned long) (childregs+1);
        p->thread.userrsp = me->thread.userrsp; 
 
-       set_ti_thread_flag(p->thread_info, TIF_FORK);
+       set_tsk_thread_flag(p, TIF_FORK);
 
        p->thread.fs = me->thread.fs;
        p->thread.gs = me->thread.gs;
@@ -563,7 +590,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
        write_pda(oldrsp, next->userrsp); 
        write_pda(pcurrent, next_p); 
        write_pda(kernelstack,
-           (unsigned long)next_p->thread_info + THREAD_SIZE - PDA_STACKOFFSET);
+                 task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
 
        /*
         * Now maybe reload the debug registers
@@ -677,7 +704,7 @@ unsigned long get_wchan(struct task_struct *p)
 
        if (!p || p == current || p->state==TASK_RUNNING)
                return 0; 
-       stack = (unsigned long)p->thread_info; 
+       stack = (unsigned long)task_stack_page(p);
        if (p->thread.rsp < stack || p->thread.rsp > stack+THREAD_SIZE)
                return 0;
        fp = *(u64 *)(p->thread.rsp);
@@ -795,8 +822,7 @@ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
 {
        struct pt_regs *pp, ptregs;
 
-       pp = (struct pt_regs *)(tsk->thread.rsp0);
-       --pp; 
+       pp = task_pt_regs(tsk);
 
        ptregs = *pp; 
        ptregs.cs &= 0xffff;
index a87b6cebe80fc45e3fced915120c619215e5e87a..53205622351c3cc8b1c7110b93239fa8dc84fce4 100644 (file)
  * in exit.c or in signal.c.
  */
 
-/* determines which flags the user has access to. */
-/* 1 = access 0 = no access */
-#define FLAG_MASK 0x44dd5UL
+/*
+ * Determines which flags the user has access to [1 = access, 0 = no access].
+ * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9).
+ * Also masks reserved bits (63-22, 15, 5, 3, 1).
+ */
+#define FLAG_MASK 0x54dd5UL
 
 /* set's the trap flag. */
 #define TRAP_FLAG 0x100UL
@@ -64,12 +67,6 @@ static inline unsigned long get_stack_long(struct task_struct *task, int offset)
        return (*((unsigned long *)stack));
 }
 
-static inline struct pt_regs *get_child_regs(struct task_struct *task)
-{
-       struct pt_regs *regs = (void *)task->thread.rsp0;
-       return regs - 1;
-}
-
 /*
  * this routine will put a word on the processes privileged stack. 
  * the offset is how far from the base addr as stored in the TSS.  
@@ -167,7 +164,7 @@ static int is_at_popf(struct task_struct *child, struct pt_regs *regs)
 
 static void set_singlestep(struct task_struct *child)
 {
-       struct pt_regs *regs = get_child_regs(child);
+       struct pt_regs *regs = task_pt_regs(child);
 
        /*
         * Always set TIF_SINGLESTEP - this guarantees that
@@ -205,7 +202,7 @@ static void clear_singlestep(struct task_struct *child)
 
        /* But touch TF only if it was set by us.. */
        if (child->ptrace & PT_DTRACE) {
-               struct pt_regs *regs = get_child_regs(child);
+               struct pt_regs *regs = task_pt_regs(child);
                regs->eflags &= ~TRAP_FLAG;
                child->ptrace &= ~PT_DTRACE;
        }
index 75235ed2b31bd61b630a30e0640b97ee674a3981..57117b8beb2bfd14e7fc51a618f56fff36176826 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/string.h>
+#include <linux/pm.h>
 #include <asm/io.h>
 #include <asm/kdebug.h>
 #include <asm/delay.h>
@@ -154,10 +155,11 @@ void machine_halt(void)
 
 void machine_power_off(void)
 {
-       if (!reboot_force) {
-               machine_shutdown();
-       }
-       if (pm_power_off)
+       if (pm_power_off) {
+               if (!reboot_force) {
+                       machine_shutdown();
+               }
                pm_power_off();
+       }
 }
 
index a0e0c9ca8f10c2e2321e9aece952ad1a2602975a..28895c03cb11e537c2ba422a991f0d6bf4f87c5a 100644 (file)
@@ -44,6 +44,8 @@
 #include <linux/mmzone.h>
 #include <linux/kexec.h>
 #include <linux/cpufreq.h>
+#include <linux/dmi.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/mtrr.h>
 #include <asm/uaccess.h>
@@ -62,7 +64,9 @@
 #include <asm/setup.h>
 #include <asm/mach_apic.h>
 #include <asm/numa.h>
+#include <asm/swiotlb.h>
 #include <asm/sections.h>
+#include <asm/gart-mapping.h>
 
 /*
  * Machine setup..
@@ -87,11 +91,6 @@ int bootloader_type;
 
 unsigned long saved_video_mode;
 
-#ifdef CONFIG_SWIOTLB
-int swiotlb;
-EXPORT_SYMBOL(swiotlb);
-#endif
-
 /*
  * Setup options
  */
@@ -278,10 +277,6 @@ static __init void parse_cmdline_early (char ** cmdline_p)
        int len = 0;
        int userdef = 0;
 
-       /* Save unparsed command line copy for /proc/cmdline */
-       memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
-       saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
-
        for (;;) {
                if (c != ' ') 
                        goto next_char; 
@@ -348,10 +343,14 @@ static __init void parse_cmdline_early (char ** cmdline_p)
                    !memcmp(from, "disableapic", 11))
                        disable_apic = 1;
 
-               if (!memcmp(from, "noapic", 6)) 
+               /* Don't confuse with noapictimer */
+               if (!memcmp(from, "noapic", 6) &&
+                       (from[6] == ' ' || from[6] == 0))
                        skip_ioapic_setup = 1;
 
-               if (!memcmp(from, "apic", 4)) { 
+               /* Make sure to not confuse with apic= */
+               if (!memcmp(from, "apic", 4) &&
+                       (from[4] == ' ' || from[4] == 0)) {
                        skip_ioapic_setup = 0;
                        ioapic_force = 1;
                }
@@ -386,11 +385,9 @@ static __init void parse_cmdline_early (char ** cmdline_p)
                        numa_setup(from+5); 
 #endif
 
-#ifdef CONFIG_GART_IOMMU 
                if (!memcmp(from,"iommu=",6)) { 
                        iommu_setup(from+6); 
                }
-#endif
 
                if (!memcmp(from,"oops=panic", 10))
                        panic_on_oops = 1;
@@ -479,6 +476,8 @@ static unsigned char *k8_nops[ASM_NOP_MAX+1] = {
      k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7,
 }; 
 
+extern char __vsyscall_0;
+
 /* Replace instructions with better alternatives for this CPU type.
 
    This runs before SMP is initialized to avoid SMP problems with
@@ -490,11 +489,17 @@ void apply_alternatives(void *start, void *end)
        struct alt_instr *a; 
        int diff, i, k;
        for (a = start; (void *)a < end; a++) { 
+               u8 *instr;
+
                if (!boot_cpu_has(a->cpuid))
                        continue;
 
                BUG_ON(a->replacementlen > a->instrlen); 
-               __inline_memcpy(a->instr, a->replacement, a->replacementlen); 
+               instr = a->instr;
+               /* vsyscall code is not mapped yet. resolve it manually. */
+               if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END)
+                       instr = __va(instr - (u8*)VSYSCALL_START + (u8*)__pa_symbol(&__vsyscall_0));
+               __inline_memcpy(instr, a->replacement, a->replacementlen);
                diff = a->instrlen - a->replacementlen; 
 
                /* Pad the rest with nops */
@@ -502,7 +507,7 @@ void apply_alternatives(void *start, void *end)
                        k = diff;
                        if (k > ASM_NOP_MAX)
                                k = ASM_NOP_MAX;
-                       __inline_memcpy(a->instr + i, k8_nops[k], k); 
+                       __inline_memcpy(instr + i, k8_nops[k], k);
                } 
        }
 } 
@@ -706,6 +711,8 @@ void __init setup_arch(char **cmdline_p)
        acpi_boot_init();
 #endif
 
+       init_cpu_to_node();
+
 #ifdef CONFIG_X86_LOCAL_APIC
        /*
         * get boot-time SMP configuration:
@@ -870,7 +877,6 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
 static int __init init_amd(struct cpuinfo_x86 *c)
 {
        int r;
-       int level;
 
 #ifdef CONFIG_SMP
        unsigned long value;
@@ -893,11 +899,6 @@ static int __init init_amd(struct cpuinfo_x86 *c)
           3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */
        clear_bit(0*32+31, &c->x86_capability);
        
-       /* C-stepping K8? */
-       level = cpuid_eax(1);
-       if ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
-               set_bit(X86_FEATURE_K8_C, &c->x86_capability);
-
        r = get_model_name(c);
        if (!r) { 
                switch (c->x86) { 
@@ -910,6 +911,10 @@ static int __init init_amd(struct cpuinfo_x86 *c)
        } 
        display_cacheinfo(c);
 
+       /* c->x86_power is 8000_0007 edx. Bit 8 is constant TSC */
+       if (c->x86_power & (1<<8))
+               set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
+
        if (c->extended_cpuid_level >= 0x80000008) {
                c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
                if (c->x86_max_cores & (c->x86_max_cores - 1))
@@ -1028,8 +1033,10 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
 
        if (c->x86 == 15)
                c->x86_cache_alignment = c->x86_clflush_size * 2;
-       if (c->x86 >= 15)
+       if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
+           (c->x86 == 0x6 && c->x86_model >= 0x0e))
                set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
+       set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
        c->x86_max_cores = intel_num_cpu_cores(c);
 
        srat_detect_node();
@@ -1228,7 +1235,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL,
-               NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow",
+               NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow",
 
                /* Transmeta-defined */
                "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -1256,7 +1263,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
                /* AMD-defined (#2) */
-               "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL,
+               "lahf_lm", "cmp_legacy", "svm", NULL, "cr8_legacy", NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -1267,7 +1274,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                "vid",  /* voltage id control */
                "ttp",  /* thermal trip */
                "tm",
-               "stc"
+               "stc",
+               NULL,
+               /* nothing */   /* constant_tsc - moved to flags */
        };
 
 
@@ -1347,8 +1356,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                unsigned i;
                for (i = 0; i < 32; i++) 
                        if (c->x86_power & (1 << i)) {
-                               if (i < ARRAY_SIZE(x86_power_flags))
-                                       seq_printf(m, " %s", x86_power_flags[i]);
+                               if (i < ARRAY_SIZE(x86_power_flags) &&
+                                       x86_power_flags[i])
+                                       seq_printf(m, "%s%s",
+                                               x86_power_flags[i][0]?" ":"",
+                                               x86_power_flags[i]);
                                else
                                        seq_printf(m, " [%d]", i);
                        }
@@ -1380,3 +1392,11 @@ struct seq_operations cpuinfo_op = {
        .stop = c_stop,
        .show = show_cpuinfo,
 };
+
+static int __init run_dmi_scan(void)
+{
+       dmi_scan_machine();
+       return 0;
+}
+core_initcall(run_dmi_scan);
+
index 06dc354375c3fa684e5d7cbe16e74ec69a4a16f5..6eff51e9400c7285587eae76077bd953542065c7 100644 (file)
@@ -30,7 +30,8 @@ char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
 
 cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
-struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 
+struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
+struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;
 
 struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 
 
@@ -110,18 +111,18 @@ void __init setup_per_cpu_areas(void)
                }
                if (!ptr)
                        panic("Cannot allocate cpu data for CPU %d\n", i);
-               cpu_pda[i].data_offset = ptr - __per_cpu_start;
+               cpu_pda(i)->data_offset = ptr - __per_cpu_start;
                memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
        }
 } 
 
 void pda_init(int cpu)
 { 
-       struct x8664_pda *pda = &cpu_pda[cpu];
+       struct x8664_pda *pda = cpu_pda(cpu);
 
        /* Setup up data that may be needed in __get_free_pages early */
        asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); 
-       wrmsrl(MSR_GS_BASE, cpu_pda + cpu);
+       wrmsrl(MSR_GS_BASE, pda);
 
        pda->cpunumber = cpu; 
        pda->irqcount = -1;
@@ -145,7 +146,7 @@ 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 - 2) * EXCEPTION_STKSZ + DEBUG_STKSZ]
 __attribute__((section(".bss.page_aligned")));
 
 /* May not be marked __init: used by software suspend */
@@ -213,23 +214,14 @@ void __cpuinit cpu_init (void)
         * Initialize the per-CPU GDT with the boot GDT,
         * and set up the GDT descriptor:
         */
-       if (cpu) {
-               memcpy(cpu_gdt_table[cpu], cpu_gdt_table[0], GDT_SIZE);
-       }       
+       if (cpu)
+               memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE);
 
        cpu_gdt_descr[cpu].size = GDT_SIZE;
-       cpu_gdt_descr[cpu].address = (unsigned long)cpu_gdt_table[cpu];
        asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu]));
        asm volatile("lidt %0" :: "m" (idt_descr));
 
-       memcpy(me->thread.tls_array, cpu_gdt_table[cpu], GDT_ENTRY_TLS_ENTRIES * 8);
-
-       /*
-        * Delete NT
-        */
-
-       asm volatile("pushfq ; popq %%rax ; btr $14,%%rax ; pushq %%rax ; popfq" ::: "eax");
-
+       memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
        syscall_init();
 
        wrmsrl(MSR_FS_BASE, 0);
@@ -243,13 +235,27 @@ void __cpuinit cpu_init (void)
         */
        for (v = 0; v < N_EXCEPTION_STACKS; v++) {
                if (cpu) {
-                       estacks = (char *)__get_free_pages(GFP_ATOMIC, 
-                                                  EXCEPTION_STACK_ORDER);
+                       static const unsigned int order[N_EXCEPTION_STACKS] = {
+                               [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER,
+                               [DEBUG_STACK - 1] = DEBUG_STACK_ORDER
+                       };
+
+                       estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
                        if (!estacks)
                                panic("Cannot allocate exception stack %ld %d\n",
                                      v, cpu); 
                }
-               estacks += EXCEPTION_STKSZ;
+               switch (v + 1) {
+#if DEBUG_STKSZ > EXCEPTION_STKSZ
+               case DEBUG_STACK:
+                       cpu_pda[cpu].debugstack = (unsigned long)estacks;
+                       estacks += DEBUG_STKSZ;
+                       break;
+#endif
+               default:
+                       estacks += EXCEPTION_STKSZ;
+                       break;
+               }
                t->ist[v] = (unsigned long)estacks;
        }
 
index cfc3d9dccbd9151d0d7ddc47b0fe87802bf7b003..19ef012b1f17a2cda5a539e64ead4e1dd477cde3 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/mmu_context.h>
 #include <asm/proto.h>
 #include <asm/apicdef.h>
+#include <asm/idle.h>
 
 /*
  *     Smarter SMP flushing macros. 
@@ -280,11 +281,6 @@ void flush_tlb_all(void)
        on_each_cpu(do_flush_tlb_all, NULL, 1, 1);
 }
 
-void smp_kdb_stop(void)
-{
-       send_IPI_allbutself(KDB_VECTOR);
-}
-
 /*
  * this function sends a 'reschedule' IPI to another CPU.
  * it goes straight through and wastes no time serializing
@@ -512,6 +508,7 @@ asmlinkage void smp_call_function_interrupt(void)
        /*
         * At this point the info structure may be out of scope unless wait==1
         */
+       exit_idle();
        irq_enter();
        (*func)(info);
        irq_exit();
index ecbd7b83acc1ff7b9024d6de6fd1762ed58320f0..a28756ef7cef972dcfd8fff90b1f8a7a19ff5e4a 100644 (file)
@@ -335,7 +335,13 @@ static __cpuinit void sync_tsc(unsigned int master)
 
 static void __cpuinit tsc_sync_wait(void)
 {
-       if (notscsync || !cpu_has_tsc)
+       /*
+        * When the CPU has synchronized TSCs assume the BIOS
+        * or the hardware already synced.  Otherwise we could
+        * mess up a possible perfect synchronization with a
+        * not-quite-perfect algorithm.
+        */
+       if (notscsync || !cpu_has_tsc || !unsynchronized_tsc())
                return;
        sync_tsc(0);
 }
@@ -646,6 +652,7 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
                send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
        } while (send_status && (timeout++ < 1000));
 
+       mb();
        atomic_set(&init_deasserted, 1);
 
        num_starts = 2;
@@ -659,7 +666,6 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
 
        for (j = 1; j <= num_starts; j++) {
                Dprintk("Sending STARTUP #%d.\n",j);
-               apic_read_around(APIC_SPIV);
                apic_write(APIC_ESR, 0);
                apic_read(APIC_ESR);
                Dprintk("After apic_write.\n");
@@ -698,7 +704,6 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
                 * Due to the Pentium erratum 3AP.
                 */
                if (maxlvt > 3) {
-                       apic_read_around(APIC_SPIV);
                        apic_write(APIC_ESR, 0);
                }
                accept_status = (apic_read(APIC_ESR) & 0xEF);
@@ -743,11 +748,35 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
        };
        DECLARE_WORK(work, do_fork_idle, &c_idle);
 
+       /* allocate memory for gdts of secondary cpus. Hotplug is considered */
+       if (!cpu_gdt_descr[cpu].address &&
+               !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) {
+               printk(KERN_ERR "Failed to allocate GDT for CPU %d\n", cpu);
+               return -1;
+       }
+
+       /* Allocate node local memory for AP pdas */
+       if (cpu_pda(cpu) == &boot_cpu_pda[cpu]) {
+               struct x8664_pda *newpda, *pda;
+               int node = cpu_to_node(cpu);
+               pda = cpu_pda(cpu);
+               newpda = kmalloc_node(sizeof (struct x8664_pda), GFP_ATOMIC,
+                                     node);
+               if (newpda) {
+                       memcpy(newpda, pda, sizeof (struct x8664_pda));
+                       cpu_pda(cpu) = newpda;
+               } else
+                       printk(KERN_ERR
+               "Could not allocate node local PDA for CPU %d on node %d\n",
+                               cpu, node);
+       }
+
+
        c_idle.idle = get_idle_for_cpu(cpu);
 
        if (c_idle.idle) {
                c_idle.idle->thread.rsp = (unsigned long) (((struct pt_regs *)
-                       (THREAD_SIZE + (unsigned long) c_idle.idle->thread_info)) - 1);
+                       (THREAD_SIZE +  task_stack_page(c_idle.idle))) - 1);
                init_idle(c_idle.idle, cpu);
                goto do_rest;
        }
@@ -778,14 +807,14 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
 
 do_rest:
 
-       cpu_pda[cpu].pcurrent = c_idle.idle;
+       cpu_pda(cpu)->pcurrent = c_idle.idle;
 
        start_rip = setup_trampoline();
 
        init_rsp = c_idle.idle->thread.rsp;
        per_cpu(init_tss,cpu).rsp0 = init_rsp;
        initial_code = start_secondary;
-       clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK);
+       clear_tsk_thread_flag(c_idle.idle, TIF_FORK);
 
        printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu,
                cpus_weight(cpu_present_map),
@@ -811,11 +840,8 @@ do_rest:
        /*
         * Be paranoid about clearing APIC errors.
         */
-       if (APIC_INTEGRATED(apic_version[apicid])) {
-               apic_read_around(APIC_SPIV);
-               apic_write(APIC_ESR, 0);
-               apic_read(APIC_ESR);
-       }
+       apic_write(APIC_ESR, 0);
+       apic_read(APIC_ESR);
 
        /*
         * Status is now clean
@@ -927,8 +953,8 @@ int additional_cpus __initdata = -1;
  *
  * Three ways to find out the number of additional hotplug CPUs:
  * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
- * - otherwise use half of the available CPUs or 2, whatever is more.
  * - The user can overwrite it with additional_cpus=NUM
+ * - Otherwise don't reserve additional CPUs.
  * We do this because additional CPUs waste a lot of memory.
  * -AK
  */
@@ -938,13 +964,10 @@ __init void prefill_possible_map(void)
        int possible;
 
        if (additional_cpus == -1) {
-               if (disabled_cpus > 0) {
+               if (disabled_cpus > 0)
                        additional_cpus = disabled_cpus;
-               } else {
-                       additional_cpus = num_processors / 2;
-                       if (additional_cpus == 0)
-                               additional_cpus = 2;
-               }
+               else
+                       additional_cpus = 0;
        }
        possible = num_processors + additional_cpus;
        if (possible > NR_CPUS) 
@@ -996,7 +1019,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
        /*
         * If we couldn't find a local APIC, then get out of here now!
         */
-       if (APIC_INTEGRATED(apic_version[boot_cpu_id]) && !cpu_has_apic) {
+       if (!cpu_has_apic) {
                printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
                        boot_cpu_id);
                printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
index fd2bef7808825fe670b3a6864cd9b7208f6746a4..ecbd34c1093d0a03109a9c99fe7c9c1c61cf646a 100644 (file)
@@ -120,7 +120,7 @@ void fix_processor_context(void)
 
        set_tss_desc(cpu,t);    /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
 
-       cpu_gdt_table[cpu][GDT_ENTRY_TSS].type = 9;
+       cpu_gdt(cpu)[GDT_ENTRY_TSS].type = 9;
 
        syscall_init();                         /* This sets MSR_*STAR and related */
        load_TR_desc();                         /* This does ltr */
index 43c9fa0f8d5fe4411bc5aa7dd07eaa4eb3bd472e..f8c47c688443a612c0d328240d4491dbb456a44b 100644 (file)
@@ -71,14 +71,6 @@ unsigned long __wall_jiffies __section_wall_jiffies = INITIAL_JIFFIES;
 struct timespec __xtime __section_xtime;
 struct timezone __sys_tz __section_sys_tz;
 
-static inline void rdtscll_sync(unsigned long *tsc)
-{
-#ifdef CONFIG_SMP
-       sync_core();
-#endif
-       rdtscll(*tsc);
-}
-
 /*
  * do_gettimeoffset() returns microseconds since last timer interrupt was
  * triggered by hardware. A memory read of HPET is slower than a register read
@@ -93,7 +85,7 @@ static inline unsigned int do_gettimeoffset_tsc(void)
 {
        unsigned long t;
        unsigned long x;
-       rdtscll_sync(&t);
+       t = get_cycles_sync();
        if (t < vxtime.last_tsc) t = vxtime.last_tsc; /* hack */
        x = ((t - vxtime.last_tsc) * vxtime.tsc_quot) >> 32;
        return x;
@@ -259,8 +251,8 @@ static void set_rtc_mmss(unsigned long nowtime)
 #endif
 
        {
-                       BIN_TO_BCD(real_seconds);
-                       BIN_TO_BCD(real_minutes);
+               BIN_TO_BCD(real_seconds);
+               BIN_TO_BCD(real_minutes);
                CMOS_WRITE(real_seconds, RTC_SECONDS);
                CMOS_WRITE(real_minutes, RTC_MINUTES);
        }
@@ -297,25 +289,21 @@ unsigned long long monotonic_clock(void)
                        last_offset = vxtime.last;
                        base = monotonic_base;
                        this_offset = hpet_readl(HPET_COUNTER);
-
                } while (read_seqretry(&xtime_lock, seq));
                offset = (this_offset - last_offset);
                offset *=(NSEC_PER_SEC/HZ)/hpet_tick;
                return base + offset;
-       }else{
+       } else {
                do {
                        seq = read_seqbegin(&xtime_lock);
 
                        last_offset = vxtime.last_tsc;
                        base = monotonic_base;
                } while (read_seqretry(&xtime_lock, seq));
-               sync_core();
-               rdtscll(this_offset);
+               this_offset = get_cycles_sync();
                offset = (this_offset - last_offset)*1000/cpu_khz; 
                return base + offset;
        }
-
-
 }
 EXPORT_SYMBOL(monotonic_clock);
 
@@ -391,7 +379,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                delay = LATCH - 1 - delay;
        }
 
-       rdtscll_sync(&tsc);
+       tsc = get_cycles_sync();
 
        if (vxtime.mode == VXTIME_HPET) {
                if (offset - vxtime.last > hpet_tick) {
@@ -471,6 +459,11 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
  
        write_sequnlock(&xtime_lock);
 
+#ifdef CONFIG_X86_LOCAL_APIC
+       if (using_apic_timer)
+               smp_send_timer_broadcast_ipi();
+#endif
+
        return IRQ_HANDLED;
 }
 
@@ -509,10 +502,10 @@ unsigned long long sched_clock(void)
        return cycles_2_ns(a);
 }
 
-unsigned long get_cmos_time(void)
+static unsigned long get_cmos_time(void)
 {
-       unsigned int timeout, year, mon, day, hour, min, sec;
-       unsigned char last, this;
+       unsigned int timeout = 1000000, year, mon, day, hour, min, sec;
+       unsigned char uip = 0, this = 0;
        unsigned long flags;
 
 /*
@@ -525,45 +518,41 @@ unsigned long get_cmos_time(void)
 
        spin_lock_irqsave(&rtc_lock, flags);
 
-       timeout = 1000000;
-       last = this = 0;
-
-       while (timeout && last && !this) {
-               last = this;
+       while (timeout && (!uip || this)) {
+               uip |= this;
                this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP;
                timeout--;
        }
 
-/*
- * Here we are safe to assume the registers won't change for a whole second, so
- * we just go ahead and read them.
-        */
-
-               sec = CMOS_READ(RTC_SECONDS);
-               min = CMOS_READ(RTC_MINUTES);
-               hour = CMOS_READ(RTC_HOURS);
-               day = CMOS_READ(RTC_DAY_OF_MONTH);
-               mon = CMOS_READ(RTC_MONTH);
-               year = CMOS_READ(RTC_YEAR);
+       /*
+        * Here we are safe to assume the registers won't change for a whole
+        * second, so we just go ahead and read them.
+        */
+       sec = CMOS_READ(RTC_SECONDS);
+       min = CMOS_READ(RTC_MINUTES);
+       hour = CMOS_READ(RTC_HOURS);
+       day = CMOS_READ(RTC_DAY_OF_MONTH);
+       mon = CMOS_READ(RTC_MONTH);
+       year = CMOS_READ(RTC_YEAR);
 
        spin_unlock_irqrestore(&rtc_lock, flags);
 
-/*
- * We know that x86-64 always uses BCD format, no need to check the config
* register.
- */
+       /*
+        * We know that x86-64 always uses BCD format, no need to check the
       * config register.
      */
 
-           BCD_TO_BIN(sec);
-           BCD_TO_BIN(min);
-           BCD_TO_BIN(hour);
-           BCD_TO_BIN(day);
-           BCD_TO_BIN(mon);
-           BCD_TO_BIN(year);
+       BCD_TO_BIN(sec);
+       BCD_TO_BIN(min);
+       BCD_TO_BIN(hour);
+       BCD_TO_BIN(day);
+       BCD_TO_BIN(mon);
+       BCD_TO_BIN(year);
 
-/*
- * x86-64 systems only exists since 2002.
- * This will work up to Dec 31, 2100
- */
+       /*
       * x86-64 systems only exists since 2002.
       * This will work up to Dec 31, 2100
       */
        year += 2000;
 
        return mktime(year, mon, day, hour, min, sec);
@@ -695,8 +684,7 @@ static unsigned int __init hpet_calibrate_tsc(void)
        do {
                local_irq_disable();
                hpet_now = hpet_readl(HPET_COUNTER);
-               sync_core();
-               rdtscl(tsc_now);
+               tsc_now = get_cycles_sync();
                local_irq_restore(flags);
        } while ((tsc_now - tsc_start) < TICK_COUNT &&
                 (hpet_now - hpet_start) < TICK_COUNT);
@@ -726,11 +714,9 @@ static unsigned int __init pit_calibrate_tsc(void)
        outb(0xb0, 0x43);
        outb((PIT_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
        outb((PIT_TICK_RATE / (1000 / 50)) >> 8, 0x42);
-       rdtscll(start);
-       sync_core();
+       start = get_cycles_sync();
        while ((inb(0x61) & 0x20) == 0);
-       sync_core();
-       rdtscll(end);
+       end = get_cycles_sync();
 
        spin_unlock_irqrestore(&i8253_lock, flags);
        
@@ -744,7 +730,7 @@ static __init int late_hpet_init(void)
        unsigned int            ntimer;
 
        if (!vxtime.hpet_address)
-          return -1;
+               return -1;
 
        memset(&hd, 0, sizeof (hd));
 
@@ -878,8 +864,6 @@ static struct irqaction irq0 = {
        timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL
 };
 
-extern void __init config_acpi_tables(void);
-
 void __init time_init(void)
 {
        char *timename;
@@ -934,7 +918,7 @@ void __init time_init(void)
        vxtime.mode = VXTIME_TSC;
        vxtime.quot = (1000000L << 32) / vxtime_hz;
        vxtime.tsc_quot = (1000L << 32) / cpu_khz;
-       rdtscll_sync(&vxtime.last_tsc);
+       vxtime.last_tsc = get_cycles_sync();
        setup_irq(0, &irq0);
 
        set_cyc2ns_scale(cpu_khz);
@@ -948,7 +932,7 @@ void __init time_init(void)
  * Make an educated guess if the TSC is trustworthy and synchronized
  * over all CPUs.
  */
-static __init int unsynchronized_tsc(void)
+__init int unsynchronized_tsc(void)
 {
 #ifdef CONFIG_SMP
        if (oem_force_hpet_timer())
@@ -959,7 +943,7 @@ static __init int unsynchronized_tsc(void)
                return 0;
 #endif
        /* Assume multi socket systems are not synchronized */
-       return num_online_cpus() > 1;
+       return num_present_cpus() > 1;
 }
 
 /*
@@ -999,6 +983,10 @@ __setup("report_lost_ticks", time_setup);
 static long clock_cmos_diff;
 static unsigned long sleep_start;
 
+/*
+ * sysfs support for the timer.
+ */
+
 static int timer_suspend(struct sys_device *dev, pm_message_t state)
 {
        /*
@@ -1041,7 +1029,6 @@ static struct sysdev_class timer_sysclass = {
        set_kset_name("timer"),
 };
 
-
 /* XXX this driverfs stuff should probably go elsewhere later -john */
 static struct sys_device device_timer = {
        .id     = 0,
@@ -1283,8 +1270,6 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 }
 #endif
 
-
-
 static int __init nohpet_setup(char *s) 
 { 
        nohpet = 1;
@@ -1301,5 +1286,3 @@ static int __init notsc_setup(char *s)
 }
 
 __setup("notsc", notsc_setup);
-
-
index 6d9c9a8e7d0ea7b13031bd586482e849d3c32abc..23a03eb91fc7ee7705dedec2a8fe1c5ecf013b5f 100644 (file)
@@ -42,8 +42,15 @@ r_base = .
        movl    $0xA5A5A5A5, trampoline_data - r_base
                                # write marker for master knows we're running
 
-       lidt    idt_48 - r_base # load idt with 0, 0
-       lgdt    gdt_48 - r_base # load gdt with whatever is appropriate
+       /*
+        * GDT tables in non default location kernel can be beyond 16MB and
+        * lgdt will not be able to load the address as in real mode default
+        * operand size is 16bit. Use lgdtl instead to force operand size
+        * to 32 bit.
+        */
+
+       lidtl   idt_48 - r_base # load idt with 0, 0
+       lgdtl   gdt_48 - r_base # load gdt with whatever is appropriate
 
        xor     %ax, %ax
        inc     %ax             # protected mode (PE) bit
index bf337f493189535f12f47f40b1ff93a94f4b26ff..8bb0aeda78b91fcb70c7aa9544b3fc2e03543860 100644 (file)
@@ -70,7 +70,6 @@ asmlinkage void reserved(void);
 asmlinkage void alignment_check(void);
 asmlinkage void machine_check(void);
 asmlinkage void spurious_interrupt_bug(void);
-asmlinkage void call_debug(void);
 
 struct notifier_block *die_chain;
 static DEFINE_SPINLOCK(die_notifier_lock);
@@ -121,19 +120,31 @@ int printk_address(unsigned long address)
 static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
                                        unsigned *usedp, const char **idp)
 {
-       static const char ids[N_EXCEPTION_STACKS][8] = {
+       static char ids[][8] = {
                [DEBUG_STACK - 1] = "#DB",
                [NMI_STACK - 1] = "NMI",
                [DOUBLEFAULT_STACK - 1] = "#DF",
                [STACKFAULT_STACK - 1] = "#SS",
                [MCE_STACK - 1] = "#MC",
+#if DEBUG_STKSZ > EXCEPTION_STKSZ
+               [N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]"
+#endif
        };
        unsigned k;
 
        for (k = 0; k < N_EXCEPTION_STACKS; k++) {
                unsigned long end;
 
-               end = per_cpu(init_tss, cpu).ist[k];
+               switch (k + 1) {
+#if DEBUG_STKSZ > EXCEPTION_STKSZ
+               case DEBUG_STACK:
+                       end = cpu_pda(cpu)->debugstack + DEBUG_STKSZ;
+                       break;
+#endif
+               default:
+                       end = per_cpu(init_tss, cpu).ist[k];
+                       break;
+               }
                if (stack >= end)
                        continue;
                if (stack >= end - EXCEPTION_STKSZ) {
@@ -143,6 +154,22 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
                        *idp = ids[k];
                        return (unsigned long *)end;
                }
+#if DEBUG_STKSZ > EXCEPTION_STKSZ
+               if (k == DEBUG_STACK - 1 && stack >= end - DEBUG_STKSZ) {
+                       unsigned j = N_EXCEPTION_STACKS - 1;
+
+                       do {
+                               ++j;
+                               end -= EXCEPTION_STKSZ;
+                               ids[j][4] = '1' + (j - N_EXCEPTION_STACKS);
+                       } while (stack < end - EXCEPTION_STKSZ);
+                       if (*usedp & (1U << j))
+                               break;
+                       *usedp |= 1U << j;
+                       *idp = ids[j];
+                       return (unsigned long *)end;
+               }
+#endif
        }
        return NULL;
 }
@@ -156,9 +183,8 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
 
 void show_trace(unsigned long *stack)
 {
-       unsigned long addr;
        const unsigned cpu = safe_smp_processor_id();
-       unsigned long *irqstack_end = (unsigned long *)cpu_pda[cpu].irqstackptr;
+       unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
        int i;
        unsigned used = 0;
 
@@ -166,8 +192,14 @@ void show_trace(unsigned long *stack)
 
 #define HANDLE_STACK(cond) \
        do while (cond) { \
-               addr = *stack++; \
+               unsigned long addr = *stack++; \
                if (kernel_text_address(addr)) { \
+                       if (i > 50) { \
+                               printk("\n       "); \
+                               i = 0; \
+                       } \
+                       else \
+                               i += printk(" "); \
                        /* \
                         * If the address is either in the text segment of the \
                         * kernel, or in the region which contains vmalloc'ed \
@@ -177,25 +209,19 @@ void show_trace(unsigned long *stack)
                         * out the call path that was taken. \
                         */ \
                        i += printk_address(addr); \
-                       if (i > 50) { \
-                               printk("\n       "); \
-                               i = 0; \
-                       } \
-                       else \
-                               i += printk(" "); \
                } \
        } while (0)
 
-       for(i = 0; ; ) {
+       for(i = 11; ; ) {
                const char *id;
                unsigned long *estack_end;
                estack_end = in_exception_stack(cpu, (unsigned long)stack,
                                                &used, &id);
 
                if (estack_end) {
-                       i += printk(" <%s> ", id);
+                       i += printk(" <%s>", id);
                        HANDLE_STACK (stack < estack_end);
-                       i += printk(" <EOE> ");
+                       i += printk(" <EOE>");
                        stack = (unsigned long *) estack_end[-2];
                        continue;
                }
@@ -205,11 +231,11 @@ void show_trace(unsigned long *stack)
                                (IRQSTACKSIZE - 64) / sizeof(*irqstack);
 
                        if (stack >= irqstack && stack < irqstack_end) {
-                               i += printk(" <IRQ> ");
+                               i += printk(" <IRQ>");
                                HANDLE_STACK (stack < irqstack_end);
                                stack = (unsigned long *) (irqstack_end[-1]);
                                irqstack_end = NULL;
-                               i += printk(" <EOI> ");
+                               i += printk(" <EOI>");
                                continue;
                        }
                }
@@ -226,8 +252,8 @@ void show_stack(struct task_struct *tsk, unsigned long * rsp)
        unsigned long *stack;
        int i;
        const int cpu = safe_smp_processor_id();
-       unsigned long *irqstack_end = (unsigned long *) (cpu_pda[cpu].irqstackptr);
-       unsigned long *irqstack = (unsigned long *) (cpu_pda[cpu].irqstackptr - IRQSTACKSIZE);    
+       unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr);
+       unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
 
        // debugging aid: "show_stack(NULL, NULL);" prints the
        // back trace for this cpu.
@@ -275,14 +301,14 @@ void show_registers(struct pt_regs *regs)
        int in_kernel = !user_mode(regs);
        unsigned long rsp;
        const int cpu = safe_smp_processor_id(); 
-       struct task_struct *cur = cpu_pda[cpu].pcurrent; 
+       struct task_struct *cur = cpu_pda(cpu)->pcurrent;
 
                rsp = regs->rsp;
 
        printk("CPU %d ", cpu);
        __show_regs(regs);
        printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
-               cur->comm, cur->pid, cur->thread_info, cur);
+               cur->comm, cur->pid, task_thread_info(cur), cur);
 
        /*
         * When in-kernel, we also print out the stack and code at the
@@ -314,20 +340,26 @@ bad:
 void handle_BUG(struct pt_regs *regs)
 { 
        struct bug_frame f;
-       char tmp;
+       long len;
+       const char *prefix = "";
 
        if (user_mode(regs))
                return; 
-       if (__copy_from_user(&f, (struct bug_frame *) regs->rip, 
+       if (__copy_from_user(&f, (const void __user *) regs->rip,
                             sizeof(struct bug_frame)))
                return; 
        if (f.filename >= 0 ||
            f.ud2[0] != 0x0f || f.ud2[1] != 0x0b) 
                return;
-       if (__get_user(tmp, (char *)(long)f.filename))
+       len = __strnlen_user((char *)(long)f.filename, PATH_MAX) - 1;
+       if (len < 0 || len >= PATH_MAX)
                f.filename = (int)(long)"unmapped filename";
+       else if (len > 50) {
+               f.filename += len - 50;
+               prefix = "...";
+       }
        printk("----------- [cut here ] --------- [please bite here ] ---------\n");
-       printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", (char *)(long)f.filename, f.line);
+       printk(KERN_ALERT "Kernel BUG at %s%.50s:%d\n", prefix, (char *)(long)f.filename, f.line);
 } 
 
 #ifdef CONFIG_BUG
@@ -382,7 +414,7 @@ void __die(const char * str, struct pt_regs * regs, long err)
        printk("DEBUG_PAGEALLOC");
 #endif
        printk("\n");
-       notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
+       notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV);
        show_registers(regs);
        /* Executive summary in case the oops scrolled away */
        printk(KERN_ALERT "RIP ");
@@ -399,11 +431,6 @@ void die(const char * str, struct pt_regs * regs, long err)
        oops_end(flags);
        do_exit(SIGSEGV); 
 }
-static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err)
-{
-       if (!(regs->eflags & VM_MASK) && (regs->cs == __KERNEL_CS))
-               die(str, regs, err);
-}
 
 void die_nmi(char *str, struct pt_regs *regs)
 {
@@ -426,19 +453,20 @@ static void __kprobes do_trap(int trapnr, int signr, char *str,
                              struct pt_regs * regs, long error_code,
                              siginfo_t *info)
 {
+       struct task_struct *tsk = current;
+
        conditional_sti(regs);
 
-       if (user_mode(regs)) {
-               struct task_struct *tsk = current;
+       tsk->thread.error_code = error_code;
+       tsk->thread.trap_no = trapnr;
 
+       if (user_mode(regs)) {
                if (exception_trace && unhandled_signal(tsk, signr))
                        printk(KERN_INFO
                               "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
                               tsk->comm, tsk->pid, str,
                               regs->rip,regs->rsp,error_code); 
 
-               tsk->thread.error_code = error_code;
-               tsk->thread.trap_no = trapnr;
                if (info)
                        force_sig_info(signr, info, tsk);
                else
@@ -485,7 +513,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
 DO_ERROR_INFO( 0, SIGFPE,  "divide error", divide_error, FPE_INTDIV, regs->rip)
 DO_ERROR( 4, SIGSEGV, "overflow", overflow)
 DO_ERROR( 5, SIGSEGV, "bounds", bounds)
-DO_ERROR_INFO( 6, SIGILL,  "invalid operand", invalid_op, ILL_ILLOPN, regs->rip)
+DO_ERROR_INFO( 6, SIGILL,  "invalid opcode", invalid_op, ILL_ILLOPN, regs->rip)
 DO_ERROR( 7, SIGSEGV, "device not available", device_not_available)
 DO_ERROR( 9, SIGFPE,  "coprocessor segment overrun", coprocessor_segment_overrun)
 DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
@@ -493,24 +521,41 @@ DO_ERROR(11, SIGBUS,  "segment not present", segment_not_present)
 DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
 DO_ERROR(18, SIGSEGV, "reserved", reserved)
 DO_ERROR(12, SIGBUS,  "stack segment", stack_segment)
-DO_ERROR( 8, SIGSEGV, "double fault", double_fault)
+
+asmlinkage void do_double_fault(struct pt_regs * regs, long error_code)
+{
+       static const char str[] = "double fault";
+       struct task_struct *tsk = current;
+
+       /* Return not checked because double check cannot be ignored */
+       notify_die(DIE_TRAP, str, regs, error_code, 8, SIGSEGV);
+
+       tsk->thread.error_code = error_code;
+       tsk->thread.trap_no = 8;
+
+       /* This is always a kernel trap and never fixable (and thus must
+          never return). */
+       for (;;)
+               die(str, regs, error_code);
+}
 
 asmlinkage void __kprobes do_general_protection(struct pt_regs * regs,
                                                long error_code)
 {
+       struct task_struct *tsk = current;
+
        conditional_sti(regs);
 
-       if (user_mode(regs)) {
-               struct task_struct *tsk = current;
+       tsk->thread.error_code = error_code;
+       tsk->thread.trap_no = 13;
 
+       if (user_mode(regs)) {
                if (exception_trace && unhandled_signal(tsk, SIGSEGV))
                        printk(KERN_INFO
                       "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
                               tsk->comm, tsk->pid,
                               regs->rip,regs->rsp,error_code); 
 
-               tsk->thread.error_code = error_code;
-               tsk->thread.trap_no = 13;
                force_sig(SIGSEGV, tsk);
                return;
        } 
@@ -573,7 +618,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
                reason = get_nmi_reason();
 
        if (!(reason & 0xc0)) {
-               if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT)
+               if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT)
                                                                == NOTIFY_STOP)
                        return;
 #ifdef CONFIG_X86_LOCAL_APIC
@@ -589,7 +634,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
                unknown_nmi_error(reason, regs);
                return;
        }
-       if (notify_die(DIE_NMI, "nmi", regs, reason, 0, SIGINT) == NOTIFY_STOP)
+       if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP)
                return; 
 
        /* AK: following checks seem to be broken on modern chipsets. FIXME */
@@ -600,6 +645,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
                io_check_error(reason, regs);
 }
 
+/* runs on IST stack. */
 asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code)
 {
        if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) {
@@ -620,7 +666,7 @@ asmlinkage struct pt_regs *sync_regs(struct pt_regs *eregs)
                ;
        /* Exception from user space */
        else if (user_mode(eregs))
-               regs = ((struct pt_regs *)current->thread.rsp0) - 1;
+               regs = task_pt_regs(current);
        /* Exception from kernel and interrupts are enabled. Move to
           kernel process stack. */
        else if (eregs->eflags & X86_EFLAGS_IF)
@@ -684,11 +730,9 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
        info.si_signo = SIGTRAP;
        info.si_errno = 0;
        info.si_code = TRAP_BRKPT;
-       if (!user_mode(regs))
-               goto clear_dr7; 
+       info.si_addr = user_mode(regs) ? (void __user *)regs->rip : NULL;
+       force_sig_info(SIGTRAP, &info, tsk);
 
-       info.si_addr = (void __user *)regs->rip;
-       force_sig_info(SIGTRAP, &info, tsk);    
 clear_dr7:
        set_debugreg(0UL, 7);
        return;
@@ -698,7 +742,7 @@ clear_TF_reenable:
        regs->eflags &= ~TF_MASK;
 }
 
-static int kernel_math_error(struct pt_regs *regs, char *str)
+static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr)
 {
        const struct exception_table_entry *fixup;
        fixup = search_exception_tables(regs->rip);
@@ -706,8 +750,9 @@ static int kernel_math_error(struct pt_regs *regs, char *str)
                regs->rip = fixup->fixup;
                return 1;
        }
-       notify_die(DIE_GPF, str, regs, 0, 16, SIGFPE);
+       notify_die(DIE_GPF, str, regs, 0, trapnr, SIGFPE);
        /* Illegal floating point operation in the kernel */
+       current->thread.trap_no = trapnr;
        die(str, regs, 0);
        return 0;
 }
@@ -726,7 +771,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
 
        conditional_sti(regs);
        if (!user_mode(regs) &&
-           kernel_math_error(regs, "kernel x87 math error"))
+           kernel_math_error(regs, "kernel x87 math error", 16))
                return;
 
        /*
@@ -795,7 +840,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
 
        conditional_sti(regs);
        if (!user_mode(regs) &&
-               kernel_math_error(regs, "kernel simd math error"))
+               kernel_math_error(regs, "kernel simd math error", 19))
                return;
 
        /*
@@ -867,12 +912,7 @@ asmlinkage void math_state_restore(void)
        if (!used_math())
                init_fpu(me);
        restore_fpu_checking(&me->thread.i387.fxsave);
-       me->thread_info->status |= TS_USEDFPU;
-}
-
-void do_call_debug(struct pt_regs *regs) 
-{ 
-       notify_die(DIE_CALL, "debug call", regs, 0, 255, SIGINT); 
+       task_thread_info(me)->status |= TS_USEDFPU;
 }
 
 void __init trap_init(void)
@@ -880,9 +920,9 @@ void __init trap_init(void)
        set_intr_gate(0,&divide_error);
        set_intr_gate_ist(1,&debug,DEBUG_STACK);
        set_intr_gate_ist(2,&nmi,NMI_STACK);
-       set_system_gate(3,&int3);
-       set_system_gate(4,&overflow);   /* int4-5 can be called from all */
-       set_system_gate(5,&bounds);
+       set_system_gate_ist(3,&int3,DEBUG_STACK); /* int3 can be called from all */
+       set_system_gate(4,&overflow);   /* int4 can be called from all */
+       set_intr_gate(5,&bounds);
        set_intr_gate(6,&invalid_op);
        set_intr_gate(7,&device_not_available);
        set_intr_gate_ist(8,&double_fault, DOUBLEFAULT_STACK);
@@ -904,8 +944,6 @@ void __init trap_init(void)
        set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall);
 #endif
        
-       set_intr_gate(KDB_VECTOR, call_debug);
-       
        /*
         * Should be a barrier for any external CPU state.
         */
index 58b19215b4b3a3c19adc2a68a3b792b325b555f3..b0eed1faf740c582c3eb4202a70d426ec98dca4b 100644 (file)
@@ -8,6 +8,8 @@
 #include <asm/page.h>
 #include <linux/config.h>
 
+#undef i386    /* in case the preprocessor is a 32bit one */
+
 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
 OUTPUT_ARCH(i386:x86-64)
 ENTRY(phys_startup_64)
@@ -189,7 +191,7 @@ SECTIONS
   /* Sections to be discarded */
   /DISCARD/ : {
        *(.exitcall.exit)
-#ifndef CONFIG_DEBUG_INFO
+#ifndef CONFIG_UNWIND_INFO
        *(.eh_frame)
 #endif
        }
diff --git a/arch/x86_64/kernel/vsmp.c b/arch/x86_64/kernel/vsmp.c
new file mode 100644 (file)
index 0000000..92f70c7
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * vSMPowered(tm) systems specific initialization
+ * Copyright (C) 2005 ScaleMP Inc.
+ *
+ * Use of this code is subject to the terms and conditions of the
+ * GNU general public license version 2. See "COPYING" or
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Ravikiran Thirumalai <kiran@scalemp.com>,
+ * Shai Fultheim <shai@scalemp.com>
+ */
+
+#include <linux/init.h>
+#include <linux/pci_ids.h>
+#include <linux/pci_regs.h>
+#include <asm/pci-direct.h>
+
+static int __init vsmp_init(void)
+{
+       void *address;
+       unsigned int cap, ctl;
+
+       /* Check if we are running on a ScaleMP vSMP box */
+       if ((read_pci_config_16(0, 0x1f, 0, PCI_VENDOR_ID) != PCI_VENDOR_ID_SCALEMP) ||
+           (read_pci_config_16(0, 0x1f, 0, PCI_DEVICE_ID) != PCI_DEVICE_ID_SCALEMP_VSMP_CTL))
+               return 0;
+
+       /* set vSMP magic bits to indicate vSMP capable kernel */
+       address = ioremap(read_pci_config(0, 0x1f, 0, PCI_BASE_ADDRESS_0), 8);
+       cap = readl(address);
+       ctl = readl(address + 4);
+       printk("vSMP CTL: capabilities:0x%08x  control:0x%08x\n", cap, ctl);
+       if (cap & ctl & (1 << 4)) {
+               /* Turn on vSMP IRQ fastpath handling (see system.h) */
+               ctl &= ~(1 << 4);
+               writel(ctl, address + 4);
+               ctl = readl(address + 4);
+               printk("vSMP CTL: control set to:0x%08x\n", ctl);
+       }
+
+       iounmap(address);
+       return 0;
+}
+
+core_initcall(vsmp_init);
index 70a0bd16085fbd3a4fe9bf6c7719e5b33cb54965..9468fb20b0bc709ee0044b63e1095036d0866e02 100644 (file)
 #include <asm/io.h>
 
 #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
-#define force_inline __attribute__((always_inline)) inline
 
 int __sysctl_vsyscall __section_sysctl_vsyscall = 1;
 seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED;
 
 #include <asm/unistd.h>
 
-static force_inline void timeval_normalize(struct timeval * tv)
+static __always_inline void timeval_normalize(struct timeval * tv)
 {
        time_t __sec;
 
@@ -53,7 +52,7 @@ static force_inline void timeval_normalize(struct timeval * tv)
        }
 }
 
-static force_inline void do_vgettimeofday(struct timeval * tv)
+static __always_inline void do_vgettimeofday(struct timeval * tv)
 {
        long sequence, t;
        unsigned long sec, usec;
@@ -66,8 +65,7 @@ static force_inline void do_vgettimeofday(struct timeval * tv)
                        (__jiffies - __wall_jiffies) * (1000000 / HZ);
 
                if (__vxtime.mode != VXTIME_HPET) {
-                       sync_core();
-                       rdtscll(t);
+                       t = get_cycles_sync();
                        if (t < __vxtime.last_tsc)
                                t = __vxtime.last_tsc;
                        usec += ((t - __vxtime.last_tsc) *
@@ -84,12 +82,12 @@ static force_inline void do_vgettimeofday(struct timeval * tv)
 }
 
 /* RED-PEN may want to readd seq locking, but then the variable should be write-once. */
-static force_inline void do_get_tz(struct timezone * tz)
+static __always_inline void do_get_tz(struct timezone * tz)
 {
        *tz = __sys_tz;
 }
 
-static force_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
+static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
 {
        int ret;
        asm volatile("vsysc2: syscall"
@@ -98,7 +96,7 @@ static force_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
        return ret;
 }
 
-static force_inline long time_syscall(long *t)
+static __always_inline long time_syscall(long *t)
 {
        long secs;
        asm volatile("vsysc1: syscall"
index b7fd6681c629f24de029938715ae32fa9bbe1495..b614d54d2ae46f2f1b02a410117740698c4aa4f8 100644 (file)
@@ -44,22 +44,15 @@ extern struct drive_info_struct drive_info;
 EXPORT_SYMBOL(drive_info);
 #endif
 
-extern unsigned long get_cmos_time(void);
-
 /* platform dependent support */
 EXPORT_SYMBOL(boot_cpu_data);
 //EXPORT_SYMBOL(dump_fpu);
 EXPORT_SYMBOL(__ioremap);
 EXPORT_SYMBOL(ioremap_nocache);
 EXPORT_SYMBOL(iounmap);
-EXPORT_SYMBOL(enable_irq);
-EXPORT_SYMBOL(disable_irq);
-EXPORT_SYMBOL(disable_irq_nosync);
-EXPORT_SYMBOL(probe_irq_mask);
 EXPORT_SYMBOL(kernel_thread);
 EXPORT_SYMBOL(pm_idle);
 EXPORT_SYMBOL(pm_power_off);
-EXPORT_SYMBOL(get_cmos_time);
 
 EXPORT_SYMBOL(__down_failed);
 EXPORT_SYMBOL(__down_failed_interruptible);
@@ -83,9 +76,6 @@ EXPORT_SYMBOL(__put_user_2);
 EXPORT_SYMBOL(__put_user_4);
 EXPORT_SYMBOL(__put_user_8);
 
-EXPORT_SYMBOL(strpbrk);
-EXPORT_SYMBOL(strstr);
-
 EXPORT_SYMBOL(strncpy_from_user);
 EXPORT_SYMBOL(__strncpy_from_user);
 EXPORT_SYMBOL(clear_user);
@@ -96,11 +86,6 @@ EXPORT_SYMBOL(copy_to_user);
 EXPORT_SYMBOL(copy_in_user);
 EXPORT_SYMBOL(strnlen_user);
 
-#ifdef CONFIG_PCI
-EXPORT_SYMBOL(pci_alloc_consistent);
-EXPORT_SYMBOL(pci_free_consistent);
-#endif
-
 #ifdef CONFIG_PCI
 EXPORT_SYMBOL(pci_mem_start);
 #endif
@@ -108,14 +93,12 @@ EXPORT_SYMBOL(pci_mem_start);
 EXPORT_SYMBOL(copy_page);
 EXPORT_SYMBOL(clear_page);
 
-EXPORT_SYMBOL(cpu_pda);
+EXPORT_SYMBOL(_cpu_pda);
 #ifdef CONFIG_SMP
 EXPORT_SYMBOL(cpu_data);
-EXPORT_SYMBOL(cpu_online_map);
 EXPORT_SYMBOL(__write_lock_failed);
 EXPORT_SYMBOL(__read_lock_failed);
 
-EXPORT_SYMBOL(synchronize_irq);
 EXPORT_SYMBOL(smp_call_function);
 EXPORT_SYMBOL(cpu_callout_map);
 #endif
@@ -136,30 +119,17 @@ EXPORT_SYMBOL_GPL(unset_nmi_callback);
 #undef memcpy
 #undef memset
 #undef memmove
-#undef memchr
 #undef strlen
-#undef strncmp
-#undef strncpy
-#undef strchr  
 
 extern void * memset(void *,int,__kernel_size_t);
 extern size_t strlen(const char *);
 extern void * memmove(void * dest,const void *src,size_t count);
-extern void *memchr(const void *s, int c, size_t n);
 extern void * memcpy(void *,const void *,__kernel_size_t);
 extern void * __memcpy(void *,const void *,__kernel_size_t);
 
 EXPORT_SYMBOL(memset);
 EXPORT_SYMBOL(strlen);
 EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(strncpy);
-EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strncat);
-EXPORT_SYMBOL(memchr);
-EXPORT_SYMBOL(strrchr);
-EXPORT_SYMBOL(strnlen);
-EXPORT_SYMBOL(memscan);
 EXPORT_SYMBOL(memcpy);
 EXPORT_SYMBOL(__memcpy);
 
index dfa358b05c893e17127178fcd8504ebfc0ce556d..79422b6559c33008dfb485ebf1638d5dfd71f973 100644 (file)
@@ -4,12 +4,9 @@
  * Functions to copy from and to user space.           
  */             
 
-#define FIX_ALIGNMENT 1
-               
        #include <asm/current.h>
        #include <asm/asm-offsets.h>
        #include <asm/thread_info.h>
-       #include <asm/cpufeature.h>
 
 /* Standard copy_to_user with segment limit checking */                
        .globl copy_to_user
@@ -21,23 +18,7 @@ copy_to_user:
        jc  bad_to_user
        cmpq threadinfo_addr_limit(%rax),%rcx
        jae bad_to_user
-2:     
-       .byte 0xe9      /* 32bit jump */
-       .long .Lcug-1f
-1:
-
-       .section .altinstr_replacement,"ax"
-3:     .byte 0xe9                      /* replacement jmp with 8 bit immediate */
-       .long copy_user_generic_c-1b    /* offset */
-       .previous
-       .section .altinstructions,"a"
-       .align 8
-       .quad  2b
-       .quad  3b
-       .byte  X86_FEATURE_K8_C
-       .byte  5
-       .byte  5
-       .previous
+       jmp copy_user_generic
 
 /* Standard copy_from_user with segment limit checking */      
        .globl copy_from_user
@@ -72,223 +53,44 @@ bad_to_user:
  * rsi source
  * rdx count
  *
+ * Only 4GB of copy is supported. This shouldn't be a problem
+ * because the kernel normally only writes from/to page sized chunks
+ * even if user space passed a longer buffer.
+ * And more would be dangerous because both Intel and AMD have
+ * errata with rep movsq > 4GB. If someone feels the need to fix
+ * this please consider this.
+ *
  * Output:             
  * eax uncopied bytes or 0 if successful.
  */
-       .globl copy_user_generic        
-       .p2align 4
-copy_user_generic:     
-       .byte 0x66,0x66,0x90    /* 5 byte nop for replacement jump */   
-       .byte 0x66,0x90
-1:             
-       .section .altinstr_replacement,"ax"
-2:     .byte 0xe9                   /* near jump with 32bit immediate */
-       .long copy_user_generic_c-1b /* offset */
-       .previous
-       .section .altinstructions,"a"
-       .align 8
-       .quad  copy_user_generic
-       .quad  2b
-       .byte  X86_FEATURE_K8_C
-       .byte  5
-       .byte  5
-       .previous
-.Lcug: 
-       pushq %rbx
-       xorl %eax,%eax          /*zero for the exception handler */
-
-#ifdef FIX_ALIGNMENT
-       /* check for bad alignment of destination */
-       movl %edi,%ecx
-       andl $7,%ecx
-       jnz  .Lbad_alignment
-.Lafter_bad_alignment:
-#endif
 
-       movq %rdx,%rcx
-
-       movl $64,%ebx   
-       shrq $6,%rdx
-       decq %rdx
-       js   .Lhandle_tail
-       
-       .p2align 4
-.Lloop:
-.Ls1:  movq (%rsi),%r11
-.Ls2:  movq 1*8(%rsi),%r8
-.Ls3:  movq 2*8(%rsi),%r9
-.Ls4:  movq 3*8(%rsi),%r10
-.Ld1:  movq %r11,(%rdi)
-.Ld2:  movq %r8,1*8(%rdi)
-.Ld3:  movq %r9,2*8(%rdi)
-.Ld4:  movq %r10,3*8(%rdi)
-               
-.Ls5:  movq 4*8(%rsi),%r11
-.Ls6:  movq 5*8(%rsi),%r8
-.Ls7:  movq 6*8(%rsi),%r9
-.Ls8:  movq 7*8(%rsi),%r10
-.Ld5:  movq %r11,4*8(%rdi)
-.Ld6:  movq %r8,5*8(%rdi)
-.Ld7:  movq %r9,6*8(%rdi)
-.Ld8:  movq %r10,7*8(%rdi)
-       
-       decq %rdx
-
-       leaq 64(%rsi),%rsi
-       leaq 64(%rdi),%rdi
-       
-       jns  .Lloop
-
-       .p2align 4
-.Lhandle_tail:
-       movl %ecx,%edx
-       andl $63,%ecx
-       shrl $3,%ecx
-       jz   .Lhandle_7
-       movl $8,%ebx
-       .p2align 4
-.Lloop_8:
-.Ls9:  movq (%rsi),%r8
-.Ld9:  movq %r8,(%rdi)
-       decl %ecx
-       leaq 8(%rdi),%rdi
-       leaq 8(%rsi),%rsi
-       jnz .Lloop_8
-       
-.Lhandle_7:            
-       movl %edx,%ecx  
-       andl $7,%ecx
-       jz   .Lende
-       .p2align 4
-.Lloop_1:
-.Ls10: movb (%rsi),%bl
-.Ld10: movb %bl,(%rdi)
-       incq %rdi
-       incq %rsi
-       decl %ecx
-       jnz .Lloop_1
-                       
-.Lende:
-       popq %rbx
-       ret     
-
-#ifdef FIX_ALIGNMENT                           
-       /* align destination */
-       .p2align 4
-.Lbad_alignment:
-       movl $8,%r9d
-       subl %ecx,%r9d
-       movl %r9d,%ecx
-       cmpq %r9,%rdx
-       jz   .Lhandle_7
-       js   .Lhandle_7
-.Lalign_1:             
-.Ls11: movb (%rsi),%bl
-.Ld11: movb %bl,(%rdi)
-       incq %rsi
-       incq %rdi
-       decl %ecx
-       jnz .Lalign_1
-       subq %r9,%rdx
-       jmp .Lafter_bad_alignment
-#endif
-       
-       /* table sorted by exception address */ 
-       .section __ex_table,"a"
-       .align 8
-       .quad .Ls1,.Ls1e
-       .quad .Ls2,.Ls2e
-       .quad .Ls3,.Ls3e
-       .quad .Ls4,.Ls4e        
-       .quad .Ld1,.Ls1e
-       .quad .Ld2,.Ls2e
-       .quad .Ld3,.Ls3e
-       .quad .Ld4,.Ls4e
-       .quad .Ls5,.Ls5e
-       .quad .Ls6,.Ls6e
-       .quad .Ls7,.Ls7e
-       .quad .Ls8,.Ls8e        
-       .quad .Ld5,.Ls5e
-       .quad .Ld6,.Ls6e
-       .quad .Ld7,.Ls7e
-       .quad .Ld8,.Ls8e
-       .quad .Ls9,.Le_quad
-       .quad .Ld9,.Le_quad
-       .quad .Ls10,.Le_byte
-       .quad .Ld10,.Le_byte
-#ifdef FIX_ALIGNMENT   
-       .quad .Ls11,.Lzero_rest
-       .quad .Ld11,.Lzero_rest
-#endif
-       .quad .Le5,.Le_zero
-       .previous
-
-       /* compute 64-offset for main loop. 8 bytes accuracy with error on the 
-          pessimistic side. this is gross. it would be better to fix the 
-          interface. */        
-       /* eax: zero, ebx: 64 */
-.Ls1e:         addl $8,%eax
-.Ls2e:         addl $8,%eax
-.Ls3e:         addl $8,%eax
-.Ls4e:         addl $8,%eax
-.Ls5e:         addl $8,%eax
-.Ls6e:         addl $8,%eax
-.Ls7e:         addl $8,%eax
-.Ls8e:         addl $8,%eax
-       addq %rbx,%rdi  /* +64 */
-       subq %rax,%rdi  /* correct destination with computed offset */
-
-       shlq $6,%rdx    /* loop counter * 64 (stride length) */
-       addq %rax,%rdx  /* add offset to loopcnt */
-       andl $63,%ecx   /* remaining bytes */
-       addq %rcx,%rdx  /* add them */
-       jmp .Lzero_rest
-
-       /* exception on quad word loop in tail handling */
-       /* ecx: loopcnt/8, %edx: length, rdi: correct */
-.Le_quad:
-       shll $3,%ecx
-       andl $7,%edx
-       addl %ecx,%edx
-       /* edx: bytes to zero, rdi: dest, eax:zero */
-.Lzero_rest:
-       movq %rdx,%rcx
-.Le_byte:
-       xorl %eax,%eax
-.Le5:  rep 
-       stosb
-       /* when there is another exception while zeroing the rest just return */
-.Le_zero:              
-       movq %rdx,%rax
-       jmp .Lende
-
-       /* C stepping K8 run faster using the string copy instructions.
-          This is also a lot simpler. Use them when possible.
-          Patch in jmps to this code instead of copying it fully
-          to avoid unwanted aliasing in the exception tables. */
-               
- /* rdi        destination
-  * rsi source
-  * rdx count
-  *
-  * Output:            
-  * eax uncopied bytes or 0 if successfull.
-  */                   
-copy_user_generic_c:
+       .globl copy_user_generic
+copy_user_generic:
        movl %edx,%ecx
        shrl $3,%ecx
        andl $7,%edx    
+       jz   5f
 1:     rep 
        movsq 
        movl %edx,%ecx
+       xor %eax,%eax
 2:     rep
        movsb
-4:     movl %ecx,%eax
        ret
+       /* align here? */
+5:     xorl %eax,%eax
+6:     rep movsq
+       ret
+
+       .section .fixup,"ax"
 3:     lea (%rdx,%rcx,8),%rax
        ret
-       
+4:     movl %ecx,%eax
+       ret
+       .previous
+
        .section __ex_table,"a"
        .quad 1b,3b
        .quad 2b,4b
+       .quad 6b,4b
        .previous
index 841bd738a189821c4046b85870d02f75ee4699e6..03c460cbdd1c0b516fcf3f262518994785bcafe6 100644 (file)
@@ -39,7 +39,7 @@ void __delay(unsigned long loops)
 
 inline void __const_udelay(unsigned long xloops)
 {
-       __delay(((xloops * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32) * HZ);
+       __delay((xloops * HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32);
 }
 
 void __udelay(unsigned long usecs)
index db8abba1ad819901a1a327465cb1d2fe7061cd5f..9bc2c295818e3c2d2faa97ecee0e17a336843b48 100644 (file)
@@ -109,14 +109,11 @@ unsigned long clear_user(void __user *to, unsigned long n)
  * Return 0 on exception, a value greater than N if too long
  */
 
-long strnlen_user(const char __user *s, long n)
+long __strnlen_user(const char __user *s, long n)
 {
        long res = 0;
        char c;
 
-       if (!access_ok(VERIFY_READ, s, n))
-               return 0;
-
        while (1) {
                if (res>n)
                        return n+1;
@@ -129,6 +126,13 @@ long strnlen_user(const char __user *s, long n)
        }
 }
 
+long strnlen_user(const char __user *s, long n)
+{
+       if (!access_ok(VERIFY_READ, s, n))
+               return 0;
+       return __strnlen_user(s, n);
+}
+
 long strlen_user(const char __user *s)
 {
        long res = 0;
index 3a63707a698ba34d954770d5a5a7b3016ac53c03..26eac194064b8a2851705db6cfa3bd1bd5bc5e8a 100644 (file)
 #include <asm-generic/sections.h>
 #include <asm/kdebug.h>
 
+/* Page fault error code bits */
+#define PF_PROT        (1<<0)          /* or no page found */
+#define PF_WRITE       (1<<1)
+#define PF_USER        (1<<2)
+#define PF_RSVD        (1<<3)
+#define PF_INSTR       (1<<4)
+
 void bust_spinlocks(int yes)
 {
        int loglevel_save = console_loglevel;
@@ -68,7 +75,7 @@ static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr,
        unsigned char *max_instr;
 
        /* If it was a exec fault ignore */
-       if (error_code & (1<<4))
+       if (error_code & PF_INSTR)
                return 0;
        
        instr = (unsigned char *)convert_rip_to_linear(current, regs);
@@ -222,17 +229,22 @@ static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs,
                                 unsigned long error_code)
 {
        unsigned long flags = oops_begin();
+       struct task_struct *tsk;
 
        printk(KERN_ALERT "%s: Corrupted page table at address %lx\n",
               current->comm, address);
        dump_pagetable(address);
+       tsk = current;
+       tsk->thread.cr2 = address;
+       tsk->thread.trap_no = 14;
+       tsk->thread.error_code = error_code;
        __die("Bad pagetable", regs, error_code);
        oops_end(flags);
        do_exit(SIGKILL);
 }
 
 /*
- * Handle a fault on the vmalloc or module mapping area
+ * Handle a fault on the vmalloc area
  *
  * This assumes no large pages in there.
  */
@@ -278,7 +290,6 @@ static int vmalloc_fault(unsigned long address)
           that. */
        if (!pte_present(*pte) || pte_pfn(*pte) != pte_pfn(*pte_ref))
                BUG();
-       __flush_tlb_all();
        return 0;
 }
 
@@ -289,12 +300,6 @@ int exception_trace = 1;
  * This routine handles page faults.  It determines the address,
  * and the problem, and then passes it off to one of the appropriate
  * routines.
- *
- * error_code:
- *     bit 0 == 0 means no page found, 1 means protection fault
- *     bit 1 == 0 means read, 1 means write
- *     bit 2 == 0 means kernel, 1 means user-mode
- *      bit 3 == 1 means fault was an instruction fetch
  */
 asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
                                        unsigned long error_code)
@@ -337,12 +342,16 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
         *
         * This verifies that the fault happens in kernel space
         * (error_code & 4) == 0, and that the fault was not a
-        * protection error (error_code & 1) == 0.
+        * protection error (error_code & 9) == 0.
         */
        if (unlikely(address >= TASK_SIZE64)) {
-               if (!(error_code & 5) &&
-                     ((address >= VMALLOC_START && address < VMALLOC_END) ||
-                      (address >= MODULES_VADDR && address < MODULES_END))) {
+               /*
+                * Don't check for the module range here: its PML4
+                * is always initialized because it's shared with the main
+                * kernel text. Only vmalloc may need PML4 syncups.
+                */
+               if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
+                     ((address >= VMALLOC_START && address < VMALLOC_END))) {
                        if (vmalloc_fault(address) < 0)
                                goto bad_area_nosemaphore;
                        return;
@@ -354,7 +363,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
                goto bad_area_nosemaphore;
        }
 
-       if (unlikely(error_code & (1 << 3)))
+       if (unlikely(error_code & PF_RSVD))
                pgtable_bad(address, regs, error_code);
 
        /*
@@ -381,7 +390,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
         * thus avoiding the deadlock.
         */
        if (!down_read_trylock(&mm->mmap_sem)) {
-               if ((error_code & 4) == 0 &&
+               if ((error_code & PF_USER) == 0 &&
                    !search_exception_tables(regs->rip))
                        goto bad_area_nosemaphore;
                down_read(&mm->mmap_sem);
@@ -408,17 +417,17 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
 good_area:
        info.si_code = SEGV_ACCERR;
        write = 0;
-       switch (error_code & 3) {
+       switch (error_code & (PF_PROT|PF_WRITE)) {
                default:        /* 3: write, present */
                        /* fall through */
-               case 2:         /* write, not present */
+               case PF_WRITE:          /* write, not present */
                        if (!(vma->vm_flags & VM_WRITE))
                                goto bad_area;
                        write++;
                        break;
-               case 1:         /* read, present */
+               case PF_PROT:           /* read, present */
                        goto bad_area;
-               case 0:         /* read, not present */
+               case 0:                 /* read, not present */
                        if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
                                goto bad_area;
        }
@@ -453,7 +462,7 @@ bad_area:
 
 bad_area_nosemaphore:
        /* User mode accesses just cause a SIGSEGV */
-       if (error_code & 4) {
+       if (error_code & PF_USER) {
                if (is_prefetch(regs, address, error_code))
                        return;
 
@@ -521,6 +530,9 @@ no_context:
        printk_address(regs->rip);
        printk("\n");
        dump_pagetable(address);
+       tsk->thread.cr2 = address;
+       tsk->thread.trap_no = 14;
+       tsk->thread.error_code = error_code;
        __die("Oops", regs, error_code);
        /* Executive summary in case the body of the oops scrolled away */
        printk(KERN_EMERG "CR2: %016lx\n", address);
@@ -546,7 +558,7 @@ do_sigbus:
        up_read(&mm->mmap_sem);
 
        /* Kernel mode? Handle exceptions or die */
-       if (!(error_code & 4))
+       if (!(error_code & PF_USER))
                goto no_context;
 
        tsk->thread.cr2 = address;
index 1faae5fc1c01c35c5e7cd7b1458bc34b5f63dd05..eca60125efc3b76a5e8145829f362f031757d35e 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/bootmem.h>
 #include <linux/proc_fs.h>
 #include <linux/pci.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
 #include <asm/proto.h>
 #include <asm/smp.h>
 #include <asm/sections.h>
+#include <asm/dma-mapping.h>
+#include <asm/swiotlb.h>
 
 #ifndef Dprintk
 #define Dprintk(x...)
 #endif
 
+struct dma_mapping_ops* dma_ops;
+EXPORT_SYMBOL(dma_ops);
+
 static unsigned long dma_reserve __initdata;
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -249,14 +255,26 @@ static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned lon
 
 static void __init find_early_table_space(unsigned long end)
 {
-       unsigned long puds, pmds, tables;
+       unsigned long puds, pmds, tables, start;
 
        puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
        pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
        tables = round_up(puds * sizeof(pud_t), PAGE_SIZE) +
                 round_up(pmds * sizeof(pmd_t), PAGE_SIZE);
 
-       table_start = find_e820_area(0x8000, __pa_symbol(&_text), tables);
+       /* Put page tables beyond the DMA zones if possible.
+          RED-PEN might be better to spread them out more over
+          memory to avoid hotspots */
+       if (end > MAX_DMA32_PFN<<PAGE_SHIFT)
+               start = MAX_DMA32_PFN << PAGE_SHIFT;
+       else if (end > MAX_DMA_PFN << PAGE_SHIFT)
+               start = MAX_DMA_PFN << PAGE_SHIFT;
+       else
+               start = 0x8000;
+
+       table_start = find_e820_area(start, end, tables);
+       if (table_start == -1)
+               table_start = find_e820_area(0x8000, end, tables);
        if (table_start == -1UL)
                panic("Cannot find space for the kernel page tables");
 
@@ -423,12 +441,9 @@ void __init mem_init(void)
        long codesize, reservedpages, datasize, initsize;
 
 #ifdef CONFIG_SWIOTLB
-       if (!iommu_aperture &&
-           (end_pfn >= 0xffffffff>>PAGE_SHIFT || force_iommu))
-              swiotlb = 1;
-       if (swiotlb)
-               swiotlb_init(); 
+       pci_swiotlb_init();
 #endif
+       no_iommu_init();
 
        /* How many end-of-memory variables you have, grandma! */
        max_low_pfn = end_pfn;
index 15b67d2760cbf8116eba1762a59e821adaddb073..6ef9f9a762356c955fe3927fbed882b663e0dd2e 100644 (file)
@@ -46,8 +46,8 @@ int numa_off __initdata;
  * 0 if memnodmap[] too small (of shift too small)
  * -1 if node overlap or lost ram (shift too big)
  */
-static int __init populate_memnodemap(
-       const struct node *nodes, int numnodes, int shift)
+static int __init
+populate_memnodemap(const struct node *nodes, int numnodes, int shift)
 {
        int i; 
        int res = -1;
@@ -81,7 +81,7 @@ int __init compute_hash_shift(struct node *nodes, int numnodes)
        while (populate_memnodemap(nodes, numnodes, shift + 1) >= 0)
                shift++;
 
-       printk(KERN_DEBUG "Using %d for the hash shift.\n",
+       printk(KERN_DEBUG "NUMA: Using %d for the hash shift.\n",
                shift);
 
        if (populate_memnodemap(nodes, numnodes, shift) != 1) {
@@ -110,7 +110,7 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long en
 
        start = round_up(start, ZONE_ALIGN); 
 
-       printk("Bootmem setup node %d %016lx-%016lx\n", nodeid, start, end);
+       printk(KERN_INFO "Bootmem setup node %d %016lx-%016lx\n", nodeid, start, end);
 
        start_pfn = start >> PAGE_SHIFT;
        end_pfn = end >> PAGE_SHIFT;
@@ -156,7 +156,7 @@ void __init setup_node_zones(int nodeid)
        start_pfn = node_start_pfn(nodeid);
        end_pfn = node_end_pfn(nodeid);
 
-       Dprintk(KERN_INFO "setting up node %d %lx-%lx\n",
+       Dprintk(KERN_INFO "Setting up node %d %lx-%lx\n",
                nodeid, start_pfn, end_pfn);
 
        size_zones(zones, holes, start_pfn, end_pfn);
@@ -200,7 +200,7 @@ static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
                while ((x << 1) < sz)
                        x <<= 1;
                if (x < sz/2)
-                       printk("Numa emulation unbalanced. Complain to maintainer\n");
+                       printk(KERN_ERR "Numa emulation unbalanced. Complain to maintainer\n");
                sz = x;
        }
 
@@ -272,7 +272,7 @@ __cpuinit void numa_add_cpu(int cpu)
 
 void __cpuinit numa_set_node(int cpu, int node)
 {
-       cpu_pda[cpu].nodenumber = node;
+       cpu_pda(cpu)->nodenumber = node;
        cpu_to_node[cpu] = node;
 }
 
@@ -330,8 +330,69 @@ __init int numa_setup(char *opt)
        return 1;
 } 
 
+/*
+ * Setup early cpu_to_node.
+ *
+ * Populate cpu_to_node[] only if x86_cpu_to_apicid[],
+ * and apicid_to_node[] tables have valid entries for a CPU.
+ * This means we skip cpu_to_node[] initialisation for NUMA
+ * emulation and faking node case (when running a kernel compiled
+ * for NUMA on a non NUMA box), which is OK as cpu_to_node[]
+ * is already initialized in a round robin manner at numa_init_array,
+ * prior to this call, and this initialization is good enough
+ * for the fake NUMA cases.
+ */
+void __init init_cpu_to_node(void)
+{
+       int i;
+       for (i = 0; i < NR_CPUS; i++) {
+               u8 apicid = x86_cpu_to_apicid[i];
+               if (apicid == BAD_APICID)
+                       continue;
+               if (apicid_to_node[apicid] == NUMA_NO_NODE)
+                       continue;
+               cpu_to_node[i] = apicid_to_node[apicid];
+       }
+}
+
 EXPORT_SYMBOL(cpu_to_node);
 EXPORT_SYMBOL(node_to_cpumask);
 EXPORT_SYMBOL(memnode_shift);
 EXPORT_SYMBOL(memnodemap);
 EXPORT_SYMBOL(node_data);
+
+#ifdef CONFIG_DISCONTIGMEM
+/*
+ * Functions to convert PFNs from/to per node page addresses.
+ * These are out of line because they are quite big.
+ * They could be all tuned by pre caching more state.
+ * Should do that.
+ */
+
+/* Requires pfn_valid(pfn) to be true */
+struct page *pfn_to_page(unsigned long pfn)
+{
+       int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT);
+       return (pfn - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map;
+}
+EXPORT_SYMBOL(pfn_to_page);
+
+unsigned long page_to_pfn(struct page *page)
+{
+       return (long)(((page) - page_zone(page)->zone_mem_map) +
+                     page_zone(page)->zone_start_pfn);
+}
+EXPORT_SYMBOL(page_to_pfn);
+
+int pfn_valid(unsigned long pfn)
+{
+       unsigned nid;
+       if (pfn >= num_physpages)
+               return 0;
+       nid = pfn_to_nid(pfn);
+       if (nid == 0xff)
+               return 0;
+       return pfn >= node_start_pfn(nid) && (pfn) < node_end_pfn(nid);
+}
+EXPORT_SYMBOL(pfn_valid);
+#endif
index 33340bd1e328dd903be99daecbe65ce9c5a35677..8b7f85608fa8d64f44bcd4b578a3f6b81887073c 100644 (file)
 #include <linux/topology.h>
 #include <asm/proto.h>
 #include <asm/numa.h>
+#include <asm/e820.h>
 
 static struct acpi_table_slit *acpi_slit;
 
 static nodemask_t nodes_parsed __initdata;
 static nodemask_t nodes_found __initdata;
 static struct node nodes[MAX_NUMNODES] __initdata;
-static __u8  pxm2node[256] = { [0 ... 255] = 0xff };
+static u8 pxm2node[256] = { [0 ... 255] = 0xff };
 
 static int node_to_pxm(int n);
 
 int pxm_to_node(int pxm)
 {
        if ((unsigned)pxm >= 256)
-               return 0;
-       return pxm2node[pxm];
+               return -1;
+       /* Extend 0xff to (int)-1 */
+       return (signed char)pxm2node[pxm];
 }
 
 static __init int setup_node(int pxm)
@@ -91,9 +93,36 @@ static __init inline int srat_disabled(void)
        return numa_off || acpi_numa < 0;
 }
 
+/*
+ * A lot of BIOS fill in 10 (= no distance) everywhere. This messes
+ * up the NUMA heuristics which wants the local node to have a smaller
+ * distance than the others.
+ * Do some quick checks here and only use the SLIT if it passes.
+ */
+static __init int slit_valid(struct acpi_table_slit *slit)
+{
+       int i, j;
+       int d = slit->localities;
+       for (i = 0; i < d; i++) {
+               for (j = 0; j < d; j++)  {
+                       u8 val = slit->entry[d*i + j];
+                       if (i == j) {
+                               if (val != 10)
+                                       return 0;
+                       } else if (val <= 10)
+                               return 0;
+               }
+       }
+       return 1;
+}
+
 /* Callback for SLIT parsing */
 void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
 {
+       if (!slit_valid(slit)) {
+               printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
+               return;
+       }
        acpi_slit = slit;
 }
 
@@ -168,12 +197,39 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
               nd->start, nd->end);
 }
 
+/* Sanity check to catch more bad SRATs (they are amazingly common).
+   Make sure the PXMs cover all memory. */
+static int nodes_cover_memory(void)
+{
+       int i;
+       unsigned long pxmram, e820ram;
+
+       pxmram = 0;
+       for_each_node_mask(i, nodes_parsed) {
+               unsigned long s = nodes[i].start >> PAGE_SHIFT;
+               unsigned long e = nodes[i].end >> PAGE_SHIFT;
+               pxmram += e - s;
+               pxmram -= e820_hole_size(s, e);
+       }
+
+       e820ram = end_pfn - e820_hole_size(0, end_pfn);
+       if (pxmram < e820ram) {
+               printk(KERN_ERR
+       "SRAT: PXMs only cover %luMB of your %luMB e820 RAM. Not used.\n",
+                       (pxmram << PAGE_SHIFT) >> 20,
+                       (e820ram << PAGE_SHIFT) >> 20);
+               return 0;
+       }
+       return 1;
+}
+
 void __init acpi_numa_arch_fixup(void) {}
 
 /* Use the information discovered above to actually set up the nodes. */
 int __init acpi_scan_nodes(unsigned long start, unsigned long end)
 {
        int i;
+
        if (acpi_numa <= 0)
                return -1;
 
@@ -184,6 +240,11 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
                        node_clear(i, nodes_parsed);
        }
 
+       if (!nodes_cover_memory()) {
+               bad_srat();
+               return -1;
+       }
+
        memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed));
        if (memnode_shift < 0) {
                printk(KERN_ERR
diff --git a/arch/x86_64/pci/Makefile-BUS b/arch/x86_64/pci/Makefile-BUS
deleted file mode 100644 (file)
index 4f0c05a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Makefile for X86_64 specific PCI routines
-#
-# Reuse the i386 PCI subsystem
-#
-CFLAGS += -I arch/i386/pci
-
-obj-y          := i386.o
-obj-$(CONFIG_PCI_DIRECT)+= direct.o
-obj-y          += fixup.o
-obj-$(CONFIG_ACPI)     += acpi.o
-obj-y                  += legacy.o irq.o common.o
-# mmconfig has a 64bit special
-obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
-
-direct-y += ../../i386/pci/direct.o
-acpi-y   += ../../i386/pci/acpi.o
-legacy-y += ../../i386/pci/legacy.o
-irq-y    += ../../i386/pci/irq.o
-common-y += ../../i386/pci/common.o
-fixup-y  += ../../i386/pci/fixup.o
-i386-y  += ../../i386/pci/i386.o
index 6a44b54ae8173718b8e4a50518511e4777a43392..f1f596644bfcd255c88a4aa9e4dac4dc06ef886c 100644 (file)
@@ -145,7 +145,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
        int user_mode = user_mode(regs);
 
        /* Set up new TSS. */
-       tos = (unsigned long)p->thread_info + THREAD_SIZE;
+       tos = (unsigned long)task_stack_page(p) + THREAD_SIZE;
        if (user_mode)
                childregs = (struct pt_regs*)(tos - PT_USER_SIZE);
        else
@@ -217,7 +217,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
 unsigned long get_wchan(struct task_struct *p)
 {
        unsigned long sp, pc;
-       unsigned long stack_page = (unsigned long) p->thread_info;
+       unsigned long stack_page = (unsigned long) task_stack_page(p);
        int count = 0;
 
        if (!p || p == current || p->state == TASK_RUNNING)
index ab5c4c65b5c416848b553efda177b10038243858..4cc85285a70ac7324bb232f4d42274a944ebcaa7 100644 (file)
@@ -72,7 +72,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                struct pt_regs *regs;
                unsigned long tmp;
 
-               regs = xtensa_pt_regs(child);
+               regs = task_pt_regs(child);
                tmp = 0;  /* Default return value. */
 
                switch(addr) {
@@ -149,7 +149,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
        case PTRACE_POKEUSR:
                {
                struct pt_regs *regs;
-               regs = xtensa_pt_regs(child);
+               regs = task_pt_regs(child);
 
                switch (addr) {
                case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1:
@@ -240,7 +240,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                 * elf_gregset_t format. */
 
                xtensa_gregset_t format;
-               struct pt_regs *regs = xtensa_pt_regs(child);
+               struct pt_regs *regs = task_pt_regs(child);
 
                do_copy_regs (&format, regs, child);
 
@@ -257,7 +257,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                 * values in the elf_gregset_t format. */
 
                xtensa_gregset_t format;
-               struct pt_regs *regs = xtensa_pt_regs(child);
+               struct pt_regs *regs = task_pt_regs(child);
 
                if (copy_from_user(&format,(void *)data,sizeof(elf_gregset_t))){
                        ret = -EFAULT;
@@ -281,7 +281,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                 * elf_fpregset_t format. */
 
                elf_fpregset_t fpregs;
-               struct pt_regs *regs = xtensa_pt_regs(child);
+               struct pt_regs *regs = task_pt_regs(child);
 
                do_save_fpregs (&fpregs, regs, child);
 
@@ -299,7 +299,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                 * values in the elf_fpregset_t format.
                 */
                elf_fpregset_t fpregs;
-               struct pt_regs *regs = xtensa_pt_regs(child);
+               struct pt_regs *regs = task_pt_regs(child);
 
                ret = 0;
                if (copy_from_user(&fpregs, (void *)data, sizeof(elf_fpregset_t))) {
index 99a4d7b2f8ad335079ae1eebeab71136f20acc35..1d0759178e4b49710c6cb90c538fc6d0c897e126 100644 (file)
@@ -610,23 +610,23 @@ void elv_completed_request(request_queue_t *q, struct request *rq)
         * request is released from the driver, io must be done
         */
        if (blk_account_rq(rq)) {
-               struct request *first_rq = list_entry_rq(q->queue_head.next);
-
                q->in_flight--;
+               if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn)
+                       e->ops->elevator_completed_req_fn(q, rq);
+       }
 
-               /*
-                * Check if the queue is waiting for fs requests to be
-                * drained for flush sequence.
-                */
-               if (q->ordseq && q->in_flight == 0 &&
+       /*
+        * Check if the queue is waiting for fs requests to be
+        * drained for flush sequence.
+        */
+       if (unlikely(q->ordseq)) {
+               struct request *first_rq = list_entry_rq(q->queue_head.next);
+               if (q->in_flight == 0 &&
                    blk_ordered_cur_seq(q) == QUEUE_ORDSEQ_DRAIN &&
                    blk_ordered_req_seq(first_rq) > QUEUE_ORDSEQ_DRAIN) {
                        blk_ordered_complete_seq(q, QUEUE_ORDSEQ_DRAIN, 0);
                        q->request_fn(q);
                }
-
-               if (blk_sorted_rq(rq) && e->ops->elevator_completed_req_fn)
-                       e->ops->elevator_completed_req_fn(q, rq);
        }
 }
 
index 82030e1dfd631b1495f87ebe632f30ed6f1086fa..e1109491c234c0ec50d15d220b81589d52cb10c6 100644 (file)
@@ -1,4 +1,4 @@
-#include <linux/sched.h>               /* for capable() */
+#include <linux/capability.h>
 #include <linux/blkdev.h>
 #include <linux/blkpg.h>
 #include <linux/hdreg.h>
index 18de84c8ccd8bca5d1fafe8d0326cda0998cf87d..cc72210687eb4f3a75e17ce39a46bfd2b4e70fa9 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/string.h>
 #include <linux/module.h>
 #include <linux/blkdev.h>
+#include <linux/capability.h>
 #include <linux/completion.h>
 #include <linux/cdrom.h>
 #include <linux/slab.h>
index c22bb9dca1ec9668b5de80242d41184535ae04ee..c26c08b368297897f6a07bb86bfb02db3212b3ce 100644 (file)
@@ -12,6 +12,7 @@
  *  On Acorn machines, the following i2c devices are on the bus:
  *     - PCF8583 real time clock & static RAM
  */
+#include <linux/capability.h>
 #include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/time.h>
index 807b0df308f18d6a31fccb0a806cd7c03195c9f7..cc049338e418b5b968888faafd22a85492752bab 100644 (file)
@@ -843,6 +843,15 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
        unsigned int i;
        unsigned int working = 0;
 
+#ifdef ARCH_APICTIMER_STOPS_ON_C3
+       struct cpuinfo_x86 *c = cpu_data + pr->id;
+       cpumask_t mask = cpumask_of_cpu(pr->id);
+
+       if (c->x86_vendor == X86_VENDOR_INTEL) {
+               on_each_cpu(switch_ipi_to_APIC_timer, &mask, 1, 1);
+       }
+#endif
+
        for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
                struct acpi_processor_cx *cx = &pr->power.states[i];
 
@@ -857,6 +866,12 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
 
                case ACPI_STATE_C3:
                        acpi_processor_power_verify_c3(pr, cx);
+#ifdef ARCH_APICTIMER_STOPS_ON_C3
+                       if (c->x86_vendor == X86_VENDOR_INTEL) {
+                               on_each_cpu(switch_APIC_timer_to_ipi,
+                                               &mask, 1, 1);
+                       }
+#endif
                        break;
                }
 
index 5b3d5e9ddcb656708956dc417c93990a8322dac9..3d384e3d34decfa481fe2ed722e2e4b9445a41d6 100644 (file)
@@ -7,6 +7,7 @@
  *
  */
 
+#include <linux/capability.h>
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/init.h>
index 58801d718cc2f7b024ab67973d514399ae240699..d1a05224627ed36aec464213ac302e8c5494982b 100644 (file)
@@ -13,8 +13,8 @@
 #include <linux/sysdev.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/sched.h>       /* capable() */
 #include <linux/topology.h>
+#include <linux/capability.h>
 #include <linux/device.h>
 #include <linux/memory.h>
 #include <linux/kobject.h>
index 3c679d30b69849f46e1cc0489de8a0b91891225a..b6e29095621401c6a1305037f681a2801c4547ab 100644 (file)
@@ -194,6 +194,8 @@ static DECLARE_WAIT_QUEUE_HEAD(ms_wait);
  */
 #define MAX_ERRORS 12
 
+#define custom amiga_custom
+
 /* Prevent "aliased" accesses. */
 static int fd_ref[4] = { 0,0,0,0 };
 static int fd_device[4] = { 0, 0, 0, 0 };
@@ -1439,6 +1441,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
 {
        int drive = iminor(inode) & 3;
        static struct floppy_struct getprm;
+       void __user *argp = (void __user *)param;
 
        switch(cmd){
        case FDFMTBEG:
@@ -1484,9 +1487,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
                getprm.head=unit[drive].type->heads;
                getprm.sect=unit[drive].dtype->sects * unit[drive].type->sect_mult;
                getprm.size=unit[drive].blocks;
-               if (copy_to_user((void *)param,
-                                (void *)&getprm,
-                                sizeof(struct floppy_struct)))
+               if (copy_to_user(argp, &getprm, sizeof(struct floppy_struct)))
                        return -EFAULT;
                break;
        case FDSETPRM:
@@ -1498,8 +1499,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
                break;
 #ifdef RAW_IOCTL
        case IOCTL_RAW_TRACK:
-               if (copy_to_user((void *)param, raw_buf,
-                                unit[drive].type->read_size))
+               if (copy_to_user(argp, raw_buf, unit[drive].type->read_size))
                        return -EFAULT;
                else
                        return unit[drive].type->read_size;
@@ -1654,12 +1654,6 @@ static struct block_device_operations floppy_fops = {
        .media_changed  = amiga_floppy_change,
 };
 
-void __init amiga_floppy_setup (char *str, int *ints)
-{
-       printk (KERN_INFO "amiflop: Setting default df0 to %x\n", ints[1]);
-       fd_def_df0 = ints[1];
-}
-
 static int __init fd_probe_drives(void)
 {
        int drive,drives,nomem;
@@ -1845,4 +1839,18 @@ void cleanup_module(void)
        unregister_blkdev(FLOPPY_MAJOR, "fd");
 }
 #endif
+
+#else
+static int __init amiga_floppy_setup (char *str)
+{
+       int n;
+       if (!MACH_IS_AMIGA)
+               return 0;
+       if (!get_option(&str, &n))
+               return 0;
+       printk (KERN_INFO "amiflop: Setting default df0 to %x\n", n);
+       fd_def_df0 = n;
+}
+
+__setup("floppy=", amiga_floppy_setup);
 #endif
index 3aa68a5447d69a65b405b7796706c89db506a648..f8ce235ccfc3b4e4ba65169e6ec3046c5fd0b67e 100644 (file)
@@ -1361,7 +1361,7 @@ static int floppy_revalidate(struct gendisk *disk)
                   formats, for 'permanent user-defined' parameter:
                   restore default_params[] here if flagged valid! */
                if (default_params[drive].blocks == 0)
-                       UDT = 0;
+                       UDT = NULL;
                else
                        UDT = &default_params[drive];
        }
@@ -1495,6 +1495,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
        struct floppy_struct getprm;
        int settype;
        struct floppy_struct setprm;
+       void __user *argp = (void __user *)param;
 
        switch (cmd) {
        case FDGETPRM:
@@ -1521,7 +1522,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
                getprm.head = 2;
                getprm.track = dtp->blocks/dtp->spt/2;
                getprm.stretch = dtp->stretch;
-               if (copy_to_user((void *)param, &getprm, sizeof(getprm)))
+               if (copy_to_user(argp, &getprm, sizeof(getprm)))
                        return -EFAULT;
                return 0;
        }
@@ -1540,7 +1541,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
                /* get the parameters from user space */
                if (floppy->ref != 1 && floppy->ref != -1)
                        return -EBUSY;
-               if (copy_from_user(&setprm, (void *) param, sizeof(setprm)))
+               if (copy_from_user(&setprm, argp, sizeof(setprm)))
                        return -EFAULT;
                /* 
                 * first of all: check for floppy change and revalidate, 
@@ -1647,7 +1648,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
        case FDFMTTRK:
                if (floppy->ref != 1 && floppy->ref != -1)
                        return -EBUSY;
-               if (copy_from_user(&fmt_desc, (void *) param, sizeof(fmt_desc)))
+               if (copy_from_user(&fmt_desc, argp, sizeof(fmt_desc)))
                        return -EFAULT;
                return do_format(drive, type, &fmt_desc);
        case FDCLRPRM:
@@ -1950,14 +1951,20 @@ Enomem:
        return -ENOMEM;
 }
 
-
-void __init atari_floppy_setup( char *str, int *ints )
+#ifndef MODULE
+static int __init atari_floppy_setup(char *str)
 {
+       int ints[3 + FD_MAX_UNITS];
        int i;
+
+       if (!MACH_IS_ATARI)
+               return 0;
+
+       str = get_options(str, 3 + FD_MAX_UNITS, ints);
        
        if (ints[0] < 1) {
                printk(KERN_ERR "ataflop_setup: no arguments!\n" );
-               return;
+               return 0;
        }
        else if (ints[0] > 2+FD_MAX_UNITS) {
                printk(KERN_ERR "ataflop_setup: too many arguments\n" );
@@ -1977,9 +1984,13 @@ void __init atari_floppy_setup( char *str, int *ints )
                else
                        UserSteprate[i-3] = ints[i];
        }
+       return 1;
 }
 
-static void atari_floppy_exit(void)
+__setup("floppy=", atari_floppy_setup);
+#endif
+
+static void __exit atari_floppy_exit(void)
 {
        int i;
        blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
index 869518e4035fab624464b646807980415afa5dc5..667a21c72edbdf40df19183c64501e25efc83fa1 100644 (file)
@@ -99,6 +99,7 @@ static char *serial_version = "4.30";
 #define _INLINE_ inline
 #endif
 
+#define custom amiga_custom
 static char *serial_name = "Amiga-builtin serial driver";
 
 static struct tty_driver *serial_driver;
@@ -1088,7 +1089,7 @@ static void rs_unthrottle(struct tty_struct * tty)
  */
 
 static int get_serial_info(struct async_struct * info,
-                          struct serial_struct * retinfo)
+                          struct serial_struct __user * retinfo)
 {
        struct serial_struct tmp;
        struct serial_state *state = info->state;
@@ -1112,7 +1113,7 @@ static int get_serial_info(struct async_struct * info,
 }
 
 static int set_serial_info(struct async_struct * info,
-                          struct serial_struct * new_info)
+                          struct serial_struct __user * new_info)
 {
        struct serial_struct new_serial;
        struct serial_state old_state, *state;
@@ -1193,7 +1194,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 async_struct * info, unsigned int *value)
+static int get_lsr_info(struct async_struct * info, unsigned int __user *value)
 {
        unsigned char status;
        unsigned int result;
@@ -1284,6 +1285,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
        struct async_struct * info = (struct async_struct *)tty->driver_data;
        struct async_icount cprev, cnow;        /* kernel counter temps */
        struct serial_icounter_struct icount;
+       void __user *argp = (void __user *)arg;
        unsigned long flags;
 
        if (serial_paranoia_check(info, tty->name, "rs_ioctl"))
@@ -1298,19 +1300,17 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
 
        switch (cmd) {
                case TIOCGSERIAL:
-                       return get_serial_info(info,
-                                              (struct serial_struct *) arg);
+                       return get_serial_info(info, argp);
                case TIOCSSERIAL:
-                       return set_serial_info(info,
-                                              (struct serial_struct *) arg);
+                       return set_serial_info(info, argp);
                case TIOCSERCONFIG:
                        return 0;
 
                case TIOCSERGETLSR: /* Get line status register */
-                       return get_lsr_info(info, (unsigned int *) arg);
+                       return get_lsr_info(info, argp);
 
                case TIOCSERGSTRUCT:
-                       if (copy_to_user((struct async_struct *) arg,
+                       if (copy_to_user(argp,
                                         info, sizeof(struct async_struct)))
                                return -EFAULT;
                        return 0;
@@ -1369,7 +1369,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        icount.brk = cnow.brk;
                        icount.buf_overrun = cnow.buf_overrun;
 
-                       if (copy_to_user((void *)arg, &icount, sizeof(icount)))
+                       if (copy_to_user(argp, &icount, sizeof(icount)))
                                return -EFAULT;
                        return 0;
                case TIOCSERGWILD:
index 8693835cb2d51f9f8868f1d2b6971e7d8942b69f..e233cf280bc024498c3fdd637d219e8159bb6f2a 100644 (file)
@@ -165,7 +165,7 @@ static int dsp56k_reset(void)
        return 0;
 }
 
-static int dsp56k_upload(u_char *bin, int len)
+static int dsp56k_upload(u_char __user *bin, int len)
 {
        int i;
        u_char *p;
@@ -199,7 +199,7 @@ static int dsp56k_upload(u_char *bin, int len)
        return 0;
 }
 
-static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
+static ssize_t dsp56k_read(struct file *file, char __user *buf, size_t count,
                           loff_t *ppos)
 {
        struct inode *inode = file->f_dentry->d_inode;
@@ -225,10 +225,10 @@ static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
                }
                case 2:  /* 16 bit */
                {
-                       short *data;
+                       short __user *data;
 
                        count /= 2;
-                       data = (short*) buf;
+                       data = (short __user *) buf;
                        handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE,
                                  put_user(dsp56k_host_interface.data.w[1], data+n++));
                        return 2*n;
@@ -244,10 +244,10 @@ static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
                }
                case 4:  /* 32 bit */
                {
-                       long *data;
+                       long __user *data;
 
                        count /= 4;
-                       data = (long*) buf;
+                       data = (long __user *) buf;
                        handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE,
                                  put_user(dsp56k_host_interface.data.l, data+n++));
                        return 4*n;
@@ -262,7 +262,7 @@ static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
        }
 }
 
-static ssize_t dsp56k_write(struct file *file, const char *buf, size_t count,
+static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t count,
                            loff_t *ppos)
 {
        struct inode *inode = file->f_dentry->d_inode;
@@ -287,10 +287,10 @@ static ssize_t dsp56k_write(struct file *file, const char *buf, size_t count,
                }
                case 2:  /* 16 bit */
                {
-                       const short *data;
+                       const short __user *data;
 
                        count /= 2;
-                       data = (const short *)buf;
+                       data = (const short __user *)buf;
                        handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT,
                                  get_user(dsp56k_host_interface.data.w[1], data+n++));
                        return 2*n;
@@ -306,10 +306,10 @@ static ssize_t dsp56k_write(struct file *file, const char *buf, size_t count,
                }
                case 4:  /* 32 bit */
                {
-                       const long *data;
+                       const long __user *data;
 
                        count /= 4;
-                       data = (const long *)buf;
+                       data = (const long __user *)buf;
                        handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT,
                                  get_user(dsp56k_host_interface.data.l, data+n++));
                        return 4*n;
@@ -328,6 +328,7 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
                        unsigned int cmd, unsigned long arg)
 {
        int dev = iminor(inode) & 0x0f;
+       void __user *argp = (void __user *)arg;
 
        switch(dev)
        {
@@ -336,9 +337,9 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
                switch(cmd) {
                case DSP56K_UPLOAD:
                {
-                       char *bin;
+                       char __user *bin;
                        int r, len;
-                       struct dsp56k_upload *binary = (struct dsp56k_upload *) arg;
+                       struct dsp56k_upload __user *binary = argp;
     
                        if(get_user(len, &binary->len) < 0)
                                return -EFAULT;
@@ -372,7 +373,7 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
                case DSP56K_HOST_FLAGS:
                {
                        int dir, out, status;
-                       struct dsp56k_host_flags *hf = (struct dsp56k_host_flags*) arg;
+                       struct dsp56k_host_flags __user *hf = argp;
     
                        if(get_user(dir, &hf->dir) < 0)
                                return -EFAULT;
index beea450ee4b220139618e622e31fe92a41ead695..c67ef3e47ad55603f08e1b8f3c91f9c2813459f3 100644 (file)
@@ -1056,7 +1056,7 @@ MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for"
 #define IPMI_MEM_ADDR_SPACE 1
 #define IPMI_IO_ADDR_SPACE  2
 
-#if defined(CONFIG_ACPI) || defined(CONFIG_X86) || defined(CONFIG_PCI)
+#if defined(CONFIG_ACPI) || defined(CONFIG_DMI) || defined(CONFIG_PCI)
 static int is_new_interface(int intf, u8 addr_space, unsigned long base_addr)
 {
        int i;
@@ -1669,7 +1669,7 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info)
 }
 #endif
 
-#ifdef CONFIG_X86
+#ifdef CONFIG_DMI
 typedef struct dmi_ipmi_data
 {
        u8              type;
@@ -1829,7 +1829,7 @@ static int try_init_smbios(int intf_num, struct smi_info **new_info)
               ipmi_data->slave_addr);
        return 0;
 }
-#endif /* CONFIG_X86 */
+#endif /* CONFIG_DMI */
 
 #ifdef CONFIG_PCI
 
@@ -2222,7 +2222,7 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
        if (rv && si_trydefaults)
                rv = try_init_acpi(intf_num, &new_smi);
 #endif
-#ifdef CONFIG_X86
+#ifdef CONFIG_DMI
        if (rv && si_trydefaults)
                rv = try_init_smbios(intf_num, &new_smi);
 #endif
@@ -2433,7 +2433,7 @@ static __init int init_ipmi_si(void)
 
        printk(KERN_INFO "IPMI System Interface driver.\n");
 
-#ifdef CONFIG_X86
+#ifdef CONFIG_DMI
        dmi_find_bmc();
 #endif
 
index bdfdfd28594d17d648b5346c273217c097974dff..86be04b241e1b5c9fb5dd477f7766b47629af604 100644 (file)
@@ -632,7 +632,7 @@ out:
        preempt_enable();
 }
 
-extern void add_input_randomness(unsigned int type, unsigned int code,
+void add_input_randomness(unsigned int type, unsigned int code,
                                 unsigned int value)
 {
        static unsigned char last_value;
index 0b397e1c8f1c7a153abbbcea4c7ff01606993494..29c980204098bde676ac05ddef832bc16e4d5783 100644 (file)
@@ -52,63 +52,57 @@ static char *_board_h_sccs_ = "@(#)board.h  1.2";
 /*
 **     The shape of the Host Control area, at offset 0x7C00, Write Only
 */
-struct s_Ctrl
-{
-       BYTE    DpCtl;                          /* 7C00 */
-       BYTE    Dp_Unused2_[127];
-       BYTE    DpIntSet;                       /* 7C80 */
-       BYTE    Dp_Unused3_[127];
-       BYTE    DpTpuReset;                     /* 7D00 */
-       BYTE    Dp_Unused4_[127];
-       BYTE    DpIntReset;                     /* 7D80 */
-       BYTE    Dp_Unused5_[127];
+struct s_Ctrl {
+       BYTE DpCtl;             /* 7C00 */
+       BYTE Dp_Unused2_[127];
+       BYTE DpIntSet;          /* 7C80 */
+       BYTE Dp_Unused3_[127];
+       BYTE DpTpuReset;        /* 7D00 */
+       BYTE Dp_Unused4_[127];
+       BYTE DpIntReset;        /* 7D80 */
+       BYTE Dp_Unused5_[127];
 };
 
 /*
 ** The PROM data area on the host (0x7C00), Read Only
 */
-struct s_Prom
-{
-       WORD    DpSlxCode[2];
-       WORD    DpRev;
-       WORD    Dp_Unused6_;
-       WORD    DpUniq[4];
-       WORD    DpJahre;
-       WORD    DpWoche;
-       WORD    DpHwFeature[5];
-       WORD    DpOemId;
-       WORD    DpSiggy[16];
+struct s_Prom {
+       WORD DpSlxCode[2];
+       WORD DpRev;
+       WORD Dp_Unused6_;
+       WORD DpUniq[4];
+       WORD DpJahre;
+       WORD DpWoche;
+       WORD DpHwFeature[5];
+       WORD DpOemId;
+       WORD DpSiggy[16];
 };
 
 /*
 ** Union of the Ctrl and Prom areas
 */
-union u_CtrlProm       /* This is the control/PROM area (0x7C00) */
-{
-       struct s_Ctrl   DpCtrl;
-       struct s_Prom   DpProm;
+union u_CtrlProm {             /* This is the control/PROM area (0x7C00) */
+       struct s_Ctrl DpCtrl;
+       struct s_Prom DpProm;
 };
 
 /*
 ** The top end of memory!
 */
-struct s_ParmMapS              /* Area containing Parm Map Pointer */
-{
-       BYTE    Dp_Unused8_[DP_PARMMAP_ADDR];
-       WORD    DpParmMapAd;
+struct s_ParmMapS {            /* Area containing Parm Map Pointer */
+       BYTE Dp_Unused8_[DP_PARMMAP_ADDR];
+       WORD DpParmMapAd;
 };
 
-struct s_StartUpS
-{
-       BYTE    Dp_Unused9_[DP_STARTUP_ADDR];
-       BYTE    Dp_LongJump[0x4];
-       BYTE    Dp_Unused10_[2];
-       BYTE    Dp_ShortJump[0x2];
+struct s_StartUpS {
+       BYTE Dp_Unused9_[DP_STARTUP_ADDR];
+       BYTE Dp_LongJump[0x4];
+       BYTE Dp_Unused10_[2];
+       BYTE Dp_ShortJump[0x2];
 };
 
-union u_Sram2ParmMap   /* This is the top of memory (0x7E00-0x7FFF) */
-{
-       BYTE    DpSramMem[DP_SRAM2_SIZE];
+union u_Sram2ParmMap {         /* This is the top of memory (0x7E00-0x7FFF) */
+       BYTE DpSramMem[DP_SRAM2_SIZE];
        struct s_ParmMapS DpParmMapS;
        struct s_StartUpS DpStartUpS;
 };
@@ -116,13 +110,12 @@ union u_Sram2ParmMap      /* This is the top of memory (0x7E00-0x7FFF) */
 /*
 **     This is the DP RAM overlay.
 */
-struct DpRam
-{
-    BYTE                DpSram1[DP_SRAM1_SIZE];     /* 0000 - 7BFF */
-    union u_CtrlProm     DpCtrlProm;                 /* 7C00 - 7DFF */
-    union u_Sram2ParmMap DpSram2ParmMap;             /* 7E00 - 7FFF */
-    BYTE                DpScratch[DP_SCRATCH_SIZE]; /* 8000 - 8FFF */
-    BYTE                DpSram3[DP_SRAM3_SIZE];     /* 9000 - FFFF */
+struct DpRam {
+       BYTE DpSram1[DP_SRAM1_SIZE];    /* 0000 - 7BFF */
+       union u_CtrlProm DpCtrlProm;    /* 7C00 - 7DFF */
+       union u_Sram2ParmMap DpSram2ParmMap;    /* 7E00 - 7FFF */
+       BYTE DpScratch[DP_SCRATCH_SIZE];        /* 8000 - 8FFF */
+       BYTE DpSram3[DP_SRAM3_SIZE];    /* 9000 - FFFF */
 };
 
 #define        DpControl       DpCtrlProm.DpCtrl.DpCtl
index c329aeb7c8713a63f920c821d2ece1e1032fe472..602266e0c0852219ddf23934829655627dec11e8 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 #ifdef SCCS
-static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h      1.1" ;
+static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h      1.1";
 #endif
 #endif
 
@@ -49,14 +49,13 @@ static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h   1.1" ;
      * Overlayed onto the Data fields of a regular
      * Packet
      ************************************************/
-typedef struct BOOT_PKT BOOT_PKT ;
+typedef struct BOOT_PKT BOOT_PKT;
 struct BOOT_PKT {
-                    short     seq_num ;
-                    char      data[10] ;
-                } ;
+       short seq_num;
+       char data[10];
+};
 
 
 #endif
 
 /*********** end of file ***********/
-
index bd4fc84ec6cff7cec72852a1f0c86233e1121b8a..dd686d58fd6662b918cbe37dcf15575a52d43b9c 100644 (file)
 
 #define MAX_RATE B2000
 
-struct    baud_rate            /* Tag for baud rates */
-{
-     /* short    host_rate,*/        /* As passed by the driver */
-     short    divisor,          /* The divisor */
-              prescaler;        /* The pre-scaler */
+struct baud_rate {             /* Tag for baud rates */
+       /* short    host_rate, *//* As passed by the driver */
+       short divisor,          /* The divisor */
+        prescaler;             /* The pre-scaler */
 };
 
 #endif
index 5b306543328f9ac649808a8afbd57c39c974b71b..af14311f9b666382677f1c639695b272da4f31ec 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 #ifdef SCCS
-static char *_rio_chan_h_sccs = "@(#)chan.h    1.1" ;
+static char *_rio_chan_h_sccs = "@(#)chan.h    1.1";
 #endif
 #endif
 
index cf056a990f185b8506027037c2abaaf83aa05579..217ff09f2fa1697e965082a36b6510894bd6e643 100644 (file)
 #define        TIMER_TICK      0x82
 #define STOP_BREAK     0x83
 #define BASE(a) ((a) < 4 ? (short*)CIRRUS_FIRST : ((a) < 8 ? (short *)CIRRUS_SECOND : ((a) < 12 ? (short*)CIRRUS_THIRD : (short *)CIRRUS_FOURTH)))
-#define txack1 ((short *)0x7104) 
-#define rxack1 ((short *)0x7102) 
+#define txack1 ((short *)0x7104)
+#define rxack1 ((short *)0x7102)
 #define mdack1  ((short *)0x7106)
-#define txack2  ((short *)0x7006) 
-#define rxack2 ((short *)0x7004) 
-#define mdack2  ((short *)0x7100) 
+#define txack2  ((short *)0x7006)
+#define rxack2 ((short *)0x7004)
+#define mdack2  ((short *)0x7100)
 #define int_latch       ((short *) 0x7800)
-#define int_status      ((short *) 0x7c00) 
-#define tx1_pending     0x20 
-#define rx1_pending     0x10 
-#define md1_pending     0x40 
-#define tx2_pending     0x02 
-#define rx2_pending     0x01 
-#define md2_pending     0x40 
+#define int_status      ((short *) 0x7c00)
+#define tx1_pending     0x20
+#define rx1_pending     0x10
+#define md1_pending     0x40
+#define tx2_pending     0x02
+#define rx2_pending     0x01
+#define md2_pending     0x40
 #define module1_bits   0x07
 #define module1_modern 0x08
 #define module2_bits   0x70
    NB. These registers are relative values on 8 bit boundaries whereas
    on the RTA's the CIRRUS registers are on word boundaries. Use pointer
    arithmetic (short *) to obtain the real addresses required */
-#define ccr    0x05    /* Channel Command Register     */
-#define ier    0x06    /* Interrupt Enable Register    */
-#define cor1   0x08    /* Channel Option Register 1    */
-#define cor2   0x09    /* Channel Option Register 2    */
-#define cor3   0x0a    /* Channel Option Register 3    */
-#define cor4   0x1e    /* Channel Option Register 4    */
-#define        cor5    0x1f    /* Channel Option Register 5    */
-
-#define ccsr   0x0b    /* Channel Control Status Register */
-#define rdcr   0x0e    /* Receive Data Count Register  */
-#define tdcr   0x12    /* Transmit Data Count Register */
-#define mcor1  0x15    /* Modem Change Option Register 1 */
-#define mcor2  0x16    /* Modem Change Option Regsiter 2 */
-
-#define livr   0x18    /* Local Interrupt Vector Register */
-#define schr1  0x1a    /* Special Character Register 1 */
-#define schr2  0x1b    /* Special Character Register 2 */
-#define schr3  0x1c    /* Special Character Register 3 */
-#define schr4  0x1d    /* Special Character Register 4 */
-
-#define rtr    0x20    /* Receive Timer Register */
-#define rtpr   0x21    /* Receive Timeout Period Register */
-#define lnc    0x24    /* Lnext character */
-
-#define rivr   0x43    /* Receive Interrupt Vector Register    */
-#define tivr   0x42    /* Transmit Interrupt Vector Register   */
-#define mivr   0x41    /* Modem Interrupt Vector Register      */
-#define gfrcr  0x40    /* Global Firmware Revision code Reg    */
-#define ricr   0x44    /* Receive Interrupting Channel Reg     */
-#define ticr   0x45    /* Transmit Interrupting Channel Reg    */
-#define micr   0x46    /* Modem Interrupting Channel Register  */
-
-#define gcr    0x4b    /* Global configuration register*/
-#define misr    0x4c    /* Modem interrupt status register */
+#define ccr    0x05            /* Channel Command Register     */
+#define ier    0x06            /* Interrupt Enable Register    */
+#define cor1   0x08            /* Channel Option Register 1    */
+#define cor2   0x09            /* Channel Option Register 2    */
+#define cor3   0x0a            /* Channel Option Register 3    */
+#define cor4   0x1e            /* Channel Option Register 4    */
+#define        cor5    0x1f            /* Channel Option Register 5    */
+
+#define ccsr   0x0b            /* Channel Control Status Register */
+#define rdcr   0x0e            /* Receive Data Count Register  */
+#define tdcr   0x12            /* Transmit Data Count Register */
+#define mcor1  0x15            /* Modem Change Option Register 1 */
+#define mcor2  0x16            /* Modem Change Option Regsiter 2 */
+
+#define livr   0x18            /* Local Interrupt Vector Register */
+#define schr1  0x1a            /* Special Character Register 1 */
+#define schr2  0x1b            /* Special Character Register 2 */
+#define schr3  0x1c            /* Special Character Register 3 */
+#define schr4  0x1d            /* Special Character Register 4 */
+
+#define rtr    0x20            /* Receive Timer Register */
+#define rtpr   0x21            /* Receive Timeout Period Register */
+#define lnc    0x24            /* Lnext character */
+
+#define rivr   0x43            /* Receive Interrupt Vector Register    */
+#define tivr   0x42            /* Transmit Interrupt Vector Register   */
+#define mivr   0x41            /* Modem Interrupt Vector Register      */
+#define gfrcr  0x40            /* Global Firmware Revision code Reg    */
+#define ricr   0x44            /* Receive Interrupting Channel Reg     */
+#define ticr   0x45            /* Transmit Interrupting Channel Reg    */
+#define micr   0x46            /* Modem Interrupting Channel Register  */
+
+#define gcr    0x4b            /* Global configuration register */
+#define misr    0x4c           /* Modem interrupt status register */
 
 #define rbusr  0x59
 #define tbusr  0x5a
 #define mbusr  0x5b
 
-#define eoir   0x60    /* End Of Interrupt Register */
-#define rdsr   0x62    /* Receive Data / Status Register */
-#define tdr    0x63    /* Transmit Data Register */
-#define svrr   0x67    /* Service Request Register */
+#define eoir   0x60            /* End Of Interrupt Register */
+#define rdsr   0x62            /* Receive Data / Status Register */
+#define tdr    0x63            /* Transmit Data Register */
+#define svrr   0x67            /* Service Request Register */
 
-#define car    0x68    /* Channel Access Register */
-#define mir    0x69    /* Modem Interrupt Register */
-#define tir    0x6a    /* Transmit Interrupt Register */
-#define rir    0x6b    /* Receive Interrupt Register */
-#define msvr1  0x6c    /* Modem Signal Value Register 1 */
-#define msvr2  0x6d    /* Modem Signal Value Register 2*/
-#define psvr   0x6f    /* Printer Signal Value Register*/
+#define car    0x68            /* Channel Access Register */
+#define mir    0x69            /* Modem Interrupt Register */
+#define tir    0x6a            /* Transmit Interrupt Register */
+#define rir    0x6b            /* Receive Interrupt Register */
+#define msvr1  0x6c            /* Modem Signal Value Register 1 */
+#define msvr2  0x6d            /* Modem Signal Value Register 2 */
+#define psvr   0x6f            /* Printer Signal Value Register */
 
-#define tbpr   0x72    /* Transmit Baud Rate Period Register */
-#define tcor   0x76    /* Transmit Clock Option Register */
+#define tbpr   0x72            /* Transmit Baud Rate Period Register */
+#define tcor   0x76            /* Transmit Clock Option Register */
 
-#define rbpr   0x78    /* Receive Baud Rate Period Register */
-#define rber   0x7a    /* Receive Baud Rate Extension Register */
-#define rcor   0x7c    /* Receive Clock Option Register*/
-#define ppr    0x7e    /* Prescalar Period Register    */
+#define rbpr   0x78            /* Receive Baud Rate Period Register */
+#define rber   0x7a            /* Receive Baud Rate Extension Register */
+#define rcor   0x7c            /* Receive Clock Option Register */
+#define ppr    0x7e            /* Prescalar Period Register    */
 
 /* Misc registers used for forcing the 1400 out of its reset woes */
 #define airl   0x6d
 
 /* RDSR - when status read from FIFO */
 #define        RDSR_BREAK              0x08    /* Break received */
-#define RDSR_TIMEOUT           0x80    /* No new data timeout */
-#define RDSR_SC1               0x10    /* Special char 1 (tx XON) matched */
-#define RDSR_SC2               0x20    /* Special char 2 (tx XOFF) matched */
-#define RDSR_SC12_MASK         0x30    /* Mask for special chars 1 and 2 */
+#define RDSR_TIMEOUT           0x80    /* No new data timeout */
+#define RDSR_SC1               0x10    /* Special char 1 (tx XON) matched */
+#define RDSR_SC2               0x20    /* Special char 2 (tx XOFF) matched */
+#define RDSR_SC12_MASK         0x30    /* Mask for special chars 1 and 2 */
 
 /* PPR */
 #define PPR_DEFAULT    0x31    /* Default value - for a 25Mhz clock gives
 #define IER_TIMEOUT    0x01    /* Timeout on no data */
 
 #define        IER_DEFAULT     0x94    /* Default values */
-#define IER_PARALLEL    0x84    /* Default for Parallel */
+#define IER_PARALLEL    0x84   /* Default for Parallel */
 #define        IER_EMPTY       0x92    /* Transmitter empty rather than ready */
 
 /* COR1 - Driver only */
 #define        COR1_7BITS      0x02    /* 7 data bits */
 #define        COR1_8BITS      0x03    /* 8 data bits */
 
-#define COR1_HOST       0xef    /* Safe host bits */
+#define COR1_HOST       0xef   /* Safe host bits */
 
 /* RTA only */
-#define COR1_CINPCK     0x00    /* Check parity of received characters */
-#define COR1_CNINPCK    0x10    /* Don't check parity */
+#define COR1_CINPCK     0x00   /* Check parity of received characters */
+#define COR1_CNINPCK    0x10   /* Don't check parity */
 
 /* COR2 bits for both RTA and driver use */
 #define        COR2_IXANY      0x80    /* IXANY - any character is XON */
 #define        COR3_FCT        0x20    /* Flow control transparency */
 #define        COR3_SCD12      0x10    /* Special character detect for SCHR's 1 + 2 */
 #define        COR3_FIFO12     0x0c    /* 12 chars for receive FIFO threshold */
-#define COR3_FIFO10     0x0a    /* 10 chars for receive FIFO threshold */
-#define COR3_FIFO8      0x08    /* 8 chars for receive FIFO threshold */
-#define COR3_FIFO6      0x06    /* 6 chars for receive FIFO threshold */
+#define COR3_FIFO10     0x0a   /* 10 chars for receive FIFO threshold */
+#define COR3_FIFO8      0x08   /* 8 chars for receive FIFO threshold */
+#define COR3_FIFO6      0x06   /* 6 chars for receive FIFO threshold */
 
 #define COR3_THRESHOLD  COR3_FIFO8     /* MUST BE LESS THAN MCOR_THRESHOLD */
 
 
 #define        MCOR_THRESHBITS 0x0F    /* mask for ANDing out the above */
 
-#define        MCOR_THRESHOLD  MCOR_THRESH9 /* MUST BE GREATER THAN COR3_THRESHOLD */
+#define        MCOR_THRESHOLD  MCOR_THRESH9    /* MUST BE GREATER THAN COR3_THRESHOLD */
 
 
 /* RTPR */
 #define CONFIG         0x01    /* Configure a port */
 #define        MOPEN           0x02    /* Modem open (block for DCD) */
 #define        CLOSE           0x03    /* Close a port */
-#define        WFLUSH          (0x04 | PRE_EMPTIVE) /* Write flush */
-#define        RFLUSH          (0x05 | PRE_EMPTIVE) /* Read flush */
-#define        RESUME          (0x06 | PRE_EMPTIVE) /* Resume if xoffed */
-#define        SBREAK          0x07    /* Start break */
+#define        WFLUSH          (0x04 | PRE_EMPTIVE)    /* Write flush */
+#define        RFLUSH          (0x05 | PRE_EMPTIVE)    /* Read flush */
+#define        RESUME          (0x06 | PRE_EMPTIVE)    /* Resume if xoffed */
+#define        SBREAK          0x07    /* Start break */
 #define        EBREAK          0x08    /* End break */
-#define        SUSPEND         (0x09 | PRE_EMPTIVE) /* Susp op (behave as tho xoffed) */
-#define FCLOSE          (0x0a | PRE_EMPTIVE) /* Force close */
-#define XPRINT          0x0b    /* Xprint packet */
-#define MBIS           (0x0c | PRE_EMPTIVE) /* Set modem lines */
-#define MBIC           (0x0d | PRE_EMPTIVE) /* Clear modem lines */
-#define MSET           (0x0e | PRE_EMPTIVE) /* Set modem lines */
+#define        SUSPEND         (0x09 | PRE_EMPTIVE)    /* Susp op (behave as tho xoffed) */
+#define FCLOSE          (0x0a | PRE_EMPTIVE)   /* Force close */
+#define XPRINT          0x0b   /* Xprint packet */
+#define MBIS           (0x0c | PRE_EMPTIVE)    /* Set modem lines */
+#define MBIC           (0x0d | PRE_EMPTIVE)    /* Clear modem lines */
+#define MSET           (0x0e | PRE_EMPTIVE)    /* Set modem lines */
 #define PCLOSE         0x0f    /* Pseudo close - Leaves rx/tx enabled */
-#define MGET           (0x10 | PRE_EMPTIVE) /* Force update of modem status */
-#define MEMDUMP                (0x11 | PRE_EMPTIVE) /* Send back mem from addr supplied */
-#define        READ_REGISTER   (0x12 | PRE_EMPTIVE) /* Read CD1400 register (debug) */
+#define MGET           (0x10 | PRE_EMPTIVE)    /* Force update of modem status */
+#define MEMDUMP                (0x11 | PRE_EMPTIVE)    /* Send back mem from addr supplied */
+#define        READ_REGISTER   (0x12 | PRE_EMPTIVE)    /* Read CD1400 register (debug) */
 
 /* "Command" packets going from remote to host COMPLETE and MODEM_STATUS
    use data[4] / data[3] to indicate current state and modem status respectively
-*/ 
+*/
 
 #define        COMPLETE        (0x20 | PRE_EMPTIVE)
                                /* Command complete */
index c369edaea2b3b3694717dc70d869725099a0d20f..797b62400c91fe26e681abb441e359c6ccad08db 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 #ifdef SCCS
-static char *_rio_cmd_h_sccs = "@(#)cmd.h      1.1" ;
+static char *_rio_cmd_h_sccs = "@(#)cmd.h      1.1";
 #endif
 #endif
 
@@ -52,7 +52,7 @@ static char *_rio_cmd_h_sccs = "@(#)cmd.h     1.1" ;
 
 #define CMD_IGNORE_PKT          ( (ushort) 0)
 #define CMD_STATUS_REQ          ( (ushort) 1)
-#define CMD_UNIT_STATUS_REQ     ( (ushort) 2)     /* Is this needed ??? */
+#define CMD_UNIT_STATUS_REQ     ( (ushort) 2)  /* Is this needed ??? */
 #define CMD_CONF_PORT           ( (ushort) 3)
 #define CMD_CONF_UNIT           ( (ushort) 4)
 #define CMD_ROUTE_MAP_REQ       ( (ushort) 5)
@@ -81,4 +81,3 @@ static char *_rio_cmd_h_sccs = "@(#)cmd.h     1.1" ;
 #endif
 
 /*********** end of file ***********/
-
index 2b8efbdbee1c3d66be9e641e8558f6d409eed4c2..a9a8c45631d754b5952e5a592a450d8097396698 100644 (file)
@@ -44,16 +44,15 @@ static char *_cmdblk_h_sccs_ = "@(#)cmdblk.h        1.2";
 ** a rup.
 */
 
-struct CmdBlk
-{
- struct CmdBlk *NextP;          /* Pointer to next command block */
- struct        PKT     Packet;         /* A packet, to copy to the rup */
-                               /* The func to call to check if OK */
-       int     (*PreFuncP)(int, struct CmdBlk *);
-       int     PreArg;         /* The arg for the func */
-                               /* The func to call when completed */
-       int     (*PostFuncP)(int, struct CmdBlk *);
-       int     PostArg;        /* The arg for the func */
+struct CmdBlk {
+       struct CmdBlk *NextP;   /* Pointer to next command block */
+       struct PKT Packet;      /* A packet, to copy to the rup */
+       /* The func to call to check if OK */
+       int (*PreFuncP) (int, struct CmdBlk *);
+       int PreArg;             /* The arg for the func */
+       /* The func to call when completed */
+       int (*PostFuncP) (int, struct CmdBlk *);
+       int PostArg;            /* The arg for the func */
 };
 
 #define NUM_RIO_CMD_BLKS (3 * (MAX_RUP * 4 + LINKS_PER_UNIT * 4))
index 46befd354f20f8a9a28c7d727f22d44d21852b80..77cee8df68ef189b65d346776e0be50b1c0b5073 100644 (file)
@@ -54,135 +54,112 @@ static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h      1.2";
 ** This structure overlays a PktCmd->CmdData structure, and so starts
 ** at Data[2] in the actual pkt!
 */
-struct BootSequence
-{
-    WORD       NumPackets;
-    WORD       LoadBase;
-    WORD       CodeSize;
+struct BootSequence {
+       WORD NumPackets;
+       WORD LoadBase;
+       WORD CodeSize;
 };
 
 #define        BOOT_SEQUENCE_LEN       8
 
-struct SamTop
-{
-    BYTE Unit;
-    BYTE Link;
+struct SamTop {
+       BYTE Unit;
+       BYTE Link;
 };
 
-struct CmdHdr
-{
-    BYTE PcCommand;
-    union
-    {
-    BYTE PcPhbNum;
-    BYTE PcLinkNum;
-    BYTE PcIDNum;
-    } U0;
+struct CmdHdr {
+       BYTE PcCommand;
+       union {
+               BYTE PcPhbNum;
+               BYTE PcLinkNum;
+               BYTE PcIDNum;
+       } U0;
 };
 
 
-struct PktCmd
-{
-    union
-    {
-       struct 
-       {
-           struct CmdHdr CmdHdr;
-           struct BootSequence PcBootSequence;
-       } S1;
-       struct
-       {
-           WORD PcSequence;
-           BYTE PcBootData[RTA_BOOT_DATA_SIZE];
-       } S2;
-       struct
-       {
-           WORD  __crud__;
-           BYTE  PcUniqNum[4];         /* this is really a uint. */
-           BYTE  PcModuleTypes;        /* what modules are fitted */
-       } S3;
-       struct
-       {
-           struct CmdHdr CmdHdr;
-           BYTE   __undefined__;
-           BYTE   PcModemStatus;
-           BYTE   PcPortStatus;
-           BYTE   PcSubCommand;        /* commands like mem or register dump */
-           WORD   PcSubAddr;           /* Address for command */
-           BYTE   PcSubData[64];       /* Date area for command */
-       } S4;
-       struct
-       {
-           struct CmdHdr CmdHdr;
-           BYTE   PcCommandText[1];
-           BYTE   __crud__[20];
-           BYTE   PcIDNum2;            /* It had to go somewhere! */
-       } S5;
-       struct
-       {
-           struct CmdHdr CmdHdr;
-           struct SamTop    Topology[LINKS_PER_UNIT];
-       } S6;
-    } U1;
+struct PktCmd {
+       union {
+               struct {
+                       struct CmdHdr CmdHdr;
+                       struct BootSequence PcBootSequence;
+               } S1;
+               struct {
+                       WORD PcSequence;
+                       BYTE PcBootData[RTA_BOOT_DATA_SIZE];
+               } S2;
+               struct {
+                       WORD __crud__;
+                       BYTE PcUniqNum[4];      /* this is really a uint. */
+                       BYTE PcModuleTypes;     /* what modules are fitted */
+               } S3;
+               struct {
+                       struct CmdHdr CmdHdr;
+                       BYTE __undefined__;
+                       BYTE PcModemStatus;
+                       BYTE PcPortStatus;
+                       BYTE PcSubCommand;      /* commands like mem or register dump */
+                       WORD PcSubAddr; /* Address for command */
+                       BYTE PcSubData[64];     /* Date area for command */
+               } S4;
+               struct {
+                       struct CmdHdr CmdHdr;
+                       BYTE PcCommandText[1];
+                       BYTE __crud__[20];
+                       BYTE PcIDNum2;  /* It had to go somewhere! */
+               } S5;
+               struct {
+                       struct CmdHdr CmdHdr;
+                       struct SamTop Topology[LINKS_PER_UNIT];
+               } S6;
+       } U1;
 };
 
-struct PktCmd_M
-{
-    union
-    {
-       struct 
-       {
-           struct
-           {
-               uchar PcCommand;
-               union
-               {
-                   uchar PcPhbNum;
-                   uchar PcLinkNum;
-                   uchar PcIDNum;
-               } U0;
-           } CmdHdr;
-           struct
-           {
-                ushort NumPackets;
-                ushort LoadBase;
-                ushort CodeSize;
-            } PcBootSequence;
-       } S1;
-       struct
-       {
-           ushort PcSequence;
-           uchar PcBootData[RTA_BOOT_DATA_SIZE];
-       } S2;
-       struct
-       {
-           ushort  __crud__;
-           uchar  PcUniqNum[4];                /* this is really a uint. */
-           uchar  PcModuleTypes;       /* what modules are fitted */
-       } S3;
-       struct
-       {
-           ushort  __cmd_hdr__;
-           uchar   __undefined__;
-           uchar   PcModemStatus;
-           uchar   PcPortStatus;
-           uchar   PcSubCommand;
-           ushort  PcSubAddr;
-           uchar   PcSubData[64];
-       } S4;
-       struct
-       {
-           ushort  __cmd_hdr__;
-           uchar   PcCommandText[1];
-           uchar   __crud__[20];
-           uchar   PcIDNum2;           /* Tacked on end */
-       } S5;
-       struct
-       {
-           ushort  __cmd_hdr__;
-           struct Top Topology[LINKS_PER_UNIT];
-       } S6;
-    } U1;
+struct PktCmd_M {
+       union {
+               struct {
+                       struct {
+                               uchar PcCommand;
+                               union {
+                                       uchar PcPhbNum;
+                                       uchar PcLinkNum;
+                                       uchar PcIDNum;
+                               } U0;
+                       } CmdHdr;
+                       struct {
+                               ushort NumPackets;
+                               ushort LoadBase;
+                               ushort CodeSize;
+                       } PcBootSequence;
+               } S1;
+               struct {
+                       ushort PcSequence;
+                       uchar PcBootData[RTA_BOOT_DATA_SIZE];
+               } S2;
+               struct {
+                       ushort __crud__;
+                       uchar PcUniqNum[4];     /* this is really a uint. */
+                       uchar PcModuleTypes;    /* what modules are fitted */
+               } S3;
+               struct {
+                       ushort __cmd_hdr__;
+                       uchar __undefined__;
+                       uchar PcModemStatus;
+                       uchar PcPortStatus;
+                       uchar PcSubCommand;
+                       ushort PcSubAddr;
+                       uchar PcSubData[64];
+               } S4;
+               struct {
+                       ushort __cmd_hdr__;
+                       uchar PcCommandText[1];
+                       uchar __crud__[20];
+                       uchar PcIDNum2; /* Tacked on end */
+               } S5;
+               struct {
+                       ushort __cmd_hdr__;
+                       struct Top Topology[LINKS_PER_UNIT];
+               } S6;
+       } U1;
 };
 
 #define Command                U1.S1.CmdHdr.PcCommand
index 1712f6261dd163be26045cf4a205247eb168237a..6853d03304a39f4e5a20cee824ed5d7a7a704120 100644 (file)
 #define        UFOAD           ( CONTROL + 4 )
 #define IWAIT          ( CONTROL + 5 )
 
-#define        IFOAD_MAGIC     0xF0AD          /* of course */
+#define        IFOAD_MAGIC     0xF0AD  /* of course */
 #define        ZOMBIE_MAGIC    (~0xDEAD)       /* not dead -> zombie */
-#define        UFOAD_MAGIC     0xD1E           /* kill-your-neighbour */
-#define        IWAIT_MAGIC     0xB1DE          /* Bide your time */
+#define        UFOAD_MAGIC     0xD1E   /* kill-your-neighbour */
+#define        IWAIT_MAGIC     0xB1DE  /* Bide your time */
 
 #endif
 
 /*********** end of file ***********/
-
index 62dba0e68b3edddc3682ad0364645f2d851554ed..28a991bd4fe6dcaeb818eb8304a09657091410fd 100644 (file)
@@ -44,18 +44,16 @@ static char *_daemon_h_sccs_ = "@(#)daemon.h        1.3";
 ** structures used on /dev/rio
 */
 
-struct Error
-{
-       uint    Error;
-       uint    Entry;
-       uint    Other;
+struct Error {
+       uint Error;
+       uint Entry;
+       uint Other;
 };
 
-struct DownLoad
-{
-       char    *DataP;
-       uint    Count;
-       uint    ProductCode;
+struct DownLoad {
+       char *DataP;
+       uint Count;
+       uint ProductCode;
 };
 
 /*
@@ -66,46 +64,41 @@ struct DownLoad
 #endif
 
 #ifndef MAX_XP_CTRL_LEN
-#define        MAX_XP_CTRL_LEN 16              /* ALSO IN PORT.H */
+#define        MAX_XP_CTRL_LEN 16      /* ALSO IN PORT.H */
 #endif
 
-struct PortSetup
-{
-       uint    From;   /* Set/Clear XP & IXANY Control from this port.... */
-       uint    To;     /* .... to this port */
-       uint    XpCps;                  /* at this speed */
-       char    XpOn[MAX_XP_CTRL_LEN];  /* this is the start string */
-       char    XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */
-       uchar   IxAny;                  /* enable/disable IXANY */
-       uchar   IxOn;                   /* enable/disable IXON */
-       uchar   Lock;                   /* lock port params */
-       uchar   Store;                  /* store params across closes */
-       uchar   Drain;                  /* close only when drained */
+struct PortSetup {
+       uint From;              /* Set/Clear XP & IXANY Control from this port.... */
+       uint To;                /* .... to this port */
+       uint XpCps;             /* at this speed */
+       char XpOn[MAX_XP_CTRL_LEN];     /* this is the start string */
+       char XpOff[MAX_XP_CTRL_LEN];    /* this is the stop string */
+       uchar IxAny;            /* enable/disable IXANY */
+       uchar IxOn;             /* enable/disable IXON */
+       uchar Lock;             /* lock port params */
+       uchar Store;            /* store params across closes */
+       uchar Drain;            /* close only when drained */
 };
 
-struct LpbReq
-{
-       uint    Host;
-       uint    Link;
-       struct  LPB     *LpbP;
+struct LpbReq {
+       uint Host;
+       uint Link;
+       struct LPB *LpbP;
 };
 
-struct RupReq
-{
-       uint    HostNum;
-       uint    RupNum;
-       struct  RUP     *RupP;
+struct RupReq {
+       uint HostNum;
+       uint RupNum;
+       struct RUP *RupP;
 };
 
-struct PortReq
-{
-       uint    SysPort;
-       struct  Port    *PortP;
+struct PortReq {
+       uint SysPort;
+       struct Port *PortP;
 };
 
-struct  StreamInfo
-{
-       uint    SysPort;
+struct StreamInfo {
+       uint SysPort;
 #if 0
        queue_t RQueue;
        queue_t WQueue;
@@ -115,68 +108,59 @@ struct  StreamInfo
 #endif
 };
 
-struct HostReq
-{
-       uint    HostNum;
-       struct  Host    *HostP;
+struct HostReq {
+       uint HostNum;
+       struct Host *HostP;
 };
 
-struct HostDpRam
-{
-       uint    HostNum;
-       struct  DpRam   *DpRamP;
+struct HostDpRam {
+       uint HostNum;
+       struct DpRam *DpRamP;
 };
 
-struct DebugCtrl
-{
-       uint    SysPort;
-       uint    Debug;
-       uint    Wait;
+struct DebugCtrl {
+       uint SysPort;
+       uint Debug;
+       uint Wait;
 };
 
-struct MapInfo
-{
-       uint    FirstPort;      /* 8 ports, starting from this (tty) number */
-       uint    RtaUnique;      /* reside on this RTA (unique number) */
+struct MapInfo {
+       uint FirstPort;         /* 8 ports, starting from this (tty) number */
+       uint RtaUnique;         /* reside on this RTA (unique number) */
 };
 
-struct MapIn
-{
-       uint    NumEntries;             /* How many port sets are we mapping? */
-       struct  MapInfo *MapInfoP;      /* Pointer to (user space) info */
+struct MapIn {
+       uint NumEntries;        /* How many port sets are we mapping? */
+       struct MapInfo *MapInfoP;       /* Pointer to (user space) info */
 };
 
-struct  SendPack
-{
-        unsigned int   PortNum;
-       unsigned char   Len;
-       unsigned char   Data[PKT_MAX_DATA_LEN];
+struct SendPack {
+       unsigned int PortNum;
+       unsigned char Len;
+       unsigned char Data[PKT_MAX_DATA_LEN];
 };
 
-struct SpecialRupCmd
-{
-       struct  PKT             Packet;
-       unsigned short  Host;
-       unsigned short  RupNum;
+struct SpecialRupCmd {
+       struct PKT Packet;
+       unsigned short Host;
+       unsigned short RupNum;
 };
 
-struct IdentifyRta
-{
-       ulong   RtaUnique;
-       uchar   ID;
+struct IdentifyRta {
+       ulong RtaUnique;
+       uchar ID;
 };
 
-struct KillNeighbour
-{
-       ulong   UniqueNum;
-       uchar   Link;
+struct KillNeighbour {
+       ulong UniqueNum;
+       uchar Link;
 };
 
 struct rioVersion {
-    char        version[MAX_VERSION_LEN];
-    char        relid[MAX_VERSION_LEN];
-    int         buildLevel;
-    char        buildDate[MAX_VERSION_LEN];
+       char version[MAX_VERSION_LEN];
+       char relid[MAX_VERSION_LEN];
+       int buildLevel;
+       char buildDate[MAX_VERSION_LEN];
 };
 
 
@@ -316,16 +300,16 @@ struct rioVersion {
 #define        RIO_SET_XP_CPS    rIOCW(155,int)
 #define RIO_GET_IXANY     rIOCR(156,int)       /* ixany allowed? */
 #define RIO_SET_IXANY     rIOCW(157,int)
-#define RIO_SET_IXANY_ON  rIOCN(158)           /* allow ixany */
-#define RIO_SET_IXANY_OFF rIOCN(159)           /* disallow ixany */
+#define RIO_SET_IXANY_ON  rIOCN(158)   /* allow ixany */
+#define RIO_SET_IXANY_OFF rIOCN(159)   /* disallow ixany */
 #define RIO_GET_MODEM     rIOCR(160,int)       /* port is modem/direct line? */
 #define RIO_SET_MODEM     rIOCW(161,int)
-#define RIO_SET_MODEM_ON  rIOCN(162)           /* port is a modem */
-#define RIO_SET_MODEM_OFF rIOCN(163)           /* port is direct */
+#define RIO_SET_MODEM_ON  rIOCN(162)   /* port is a modem */
+#define RIO_SET_MODEM_OFF rIOCN(163)   /* port is direct */
 #define RIO_GET_IXON      rIOCR(164,int)       /* ixon allowed? */
 #define RIO_SET_IXON      rIOCW(165,int)
-#define RIO_SET_IXON_ON   rIOCN(166)           /* allow ixon */
-#define RIO_SET_IXON_OFF  rIOCN(167)           /* disallow ixon */
+#define RIO_SET_IXON_ON   rIOCN(166)   /* allow ixon */
+#define RIO_SET_IXON_OFF  rIOCN(167)   /* disallow ixon */
 
 #define RIO_GET_SIVIEW   ((('s')<<8) | 106)    /* backwards compatible with SI */
 
index b6e0d0935552579b946d6feb10f22b2ff8a0dfc1..6ae95c00db4ae13b8273298eb8e69d6b1016fe27 100644 (file)
@@ -33,7 +33,7 @@
 #define        DBPACKET(pkt, opt, str, chn)    debug_packet((pkt), (opt), (str), (chn))
 #else
 #define        DBPACKET(pkt, opt, str, c)
-#endif /* DCIRRUS */
+#endif                         /* DCIRRUS */
 
 
-#endif /* _debug_h_ */
+#endif                         /* _debug_h_ */
index 2e7309e276227cf48cd290d30e327c611dd587ed..5b600c32ac021a578fb32f75e6bdea2ed89b9a38 100644 (file)
 
 #ifndef lint
 #ifdef SCCS
-static char *_rio_defaults_h_sccs = "@(#)defaults.h    1.1" ;
+static char *_rio_defaults_h_sccs = "@(#)defaults.h    1.1";
 #endif
 #endif
 
 
-#define MILLISECOND           (int) (1000/64)   /* 15.625 low ticks */
-#define SECOND                (int) 15625       /* Low priority ticks */
+#define MILLISECOND           (int) (1000/64)  /* 15.625 low ticks */
+#define SECOND                (int) 15625      /* Low priority ticks */
 
 #ifdef RTA
 #define RX_LIMIT       (ushort) 3
@@ -56,4 +56,3 @@ static char *_rio_defaults_h_sccs = "@(#)defaults.h   1.1" ;
 
 
 /*********** end of file ***********/
-
index 59371b0528b071bb5eb0221ff648c5f2a8c09e7c..c2abaf0eab04e479d9a3dfa98abc874a7d909fea 100644 (file)
@@ -60,7 +60,7 @@ static char *_eisa_h_sccs_ = "@(#)eisa.h      1.2";
 
 #define        EISA_PRODUCT_IDENT_LO           0xC80   /* where RIO_EISA_IDENT is */
 #define        EISA_PRODUCT_IDENT_HI           0xC81
-#define        EISA_PRODUCT_NUMBER             0xC82   /* where PROD_CODE is */
+#define        EISA_PRODUCT_NUMBER             0xC82   /* where PROD_CODE is */
 #define        EISA_REVISION_NUMBER            0xC83   /* revision (1dp) */
 #define        EISA_ENABLE                     0xC84   /* set LSB to enable card */
 #define        EISA_UNIQUE_NUM_0               0xC88   /* vomit */
@@ -101,4 +101,4 @@ static char *_eisa_h_sccs_ = "@(#)eisa.h    1.2";
 #define        INBZ(z,x)       inb(((z)<<12) | (x))
 #define        OUTBZ(z,x,y)    outb((((z)<<12) | (x)), y)
 
-#endif /* __rio_eisa_h__ */
+#endif                         /* __rio_eisa_h__ */
index 8e9a419e15b01aef940cec275e38ab5150236f93..e06673fa48cf7ac7a17a429bec74547a5b381e15 100644 (file)
@@ -36,7 +36,7 @@
 
 #ifndef lint
 #ifdef SCCS
-static char *_rio_enable_h_sccs = "@(#)enable.h        1.1" ;
+static char *_rio_enable_h_sccs = "@(#)enable.h        1.1";
 #endif
 #endif
 
@@ -46,5 +46,3 @@ static char *_rio_enable_h_sccs = "@(#)enable.h       1.1" ;
 
 
 /*********** end of file ***********/
-
-
index 229438e355f2d5581dbca2b54d73b69e2ee53692..f20f0789db8fcc88a6b4fed11da4607105908570 100644 (file)
@@ -80,6 +80,3 @@
 
 
 /*********** end of file ***********/
-
-
-
index f920b9f3e2bd80bc23c302e457a26a2a61a62935..1d0d8914433761724854c5fd3b7e4412c37559ac 100644 (file)
@@ -101,4 +101,4 @@ static char *_errors_h_sccs_ = "@(#)errors.h        1.2";
 #define        NOT_ENOUGH_CORE_FOR_PCI_COPY    53
 
 
-#endif /* __rio_errors_h__ */
+#endif                         /* __rio_errors_h__ */
index a8b65ae0de90dc9e976923eeea1928c9a6e67f83..3c7c91ace3eec8aeb312298096495ab7ce1a4dba 100644 (file)
 
 #ifndef lint
 #ifdef SCCS
-static char *_rio_formpkt_h_sccs = "@(#)formpkt.h      1.1" ;
+static char *_rio_formpkt_h_sccs = "@(#)formpkt.h      1.1";
 #endif
 #endif
 
-typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1 ;
+typedef struct FORM_BOOT_PKT_1 FORM_BOOT_PKT_1;
 struct FORM_BOOT_PKT_1 {
-                           ushort pkt_number ;
-                           ushort pkt_total ;
-                           ushort boot_top ;
-                       } ;
+       ushort pkt_number;
+       ushort pkt_total;
+       ushort boot_top;
+};
 
-typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2 ;
+typedef struct FORM_BOOT_PKT_2 FORM_BOOT_PKT_2;
 struct FORM_BOOT_PKT_2 {
-                           ushort pkt_number ;
-                           char   boot_data[10] ;
-                       } ;
+       ushort pkt_number;
+       char boot_data[10];
+};
 
 
-typedef struct FORM_ATTACH_RTA   FORM_ATTACH_RTA ;
-struct FORM_ATTACH_RTA  {
-                       char    cmd_code ;
-                       char    booter_serial[4] ;
-                       char    booter_link ;
-                       char    bootee_serial[4] ;
-                       char    bootee_link ;
-                   } ;
+typedef struct FORM_ATTACH_RTA FORM_ATTACH_RTA;
+struct FORM_ATTACH_RTA {
+       char cmd_code;
+       char booter_serial[4];
+       char booter_link;
+       char bootee_serial[4];
+       char bootee_link;
+};
 
 
-typedef struct FORM_BOOT_ID   FORM_BOOT_ID ;
-struct FORM_BOOT_ID  {
-                       char    cmd_code ;
-                       char    bootee_serial[4] ;
-                       char    bootee_prod_id ;
-                       char    bootee_link ;
-                   } ;
+typedef struct FORM_BOOT_ID FORM_BOOT_ID;
+struct FORM_BOOT_ID {
+       char cmd_code;
+       char bootee_serial[4];
+       char bootee_prod_id;
+       char bootee_link;
+};
 
 
 
-typedef struct FORM_ROUTE_1   FORM_ROUTE_1 ;
+typedef struct FORM_ROUTE_1 FORM_ROUTE_1;
 struct FORM_ROUTE_1 {
-                        char     cmd_code ;
-                        char     pkt_number ;
-                        char     total_in_sequence ;
-                        char     unit_id ;
-                        char     host_unit_id ;
-                    } ;
-
-typedef struct FORM_ROUTE_2   FORM_ROUTE_2 ;
+       char cmd_code;
+       char pkt_number;
+       char total_in_sequence;
+       char unit_id;
+       char host_unit_id;
+};
+
+typedef struct FORM_ROUTE_2 FORM_ROUTE_2;
 struct FORM_ROUTE_2 {
-                        char   cmd_code ;
-                        char   pkt_number ;
-                        char   total_in_sequence ;
-                        char   route_data[9] ;
-                    } ;
+       char cmd_code;
+       char pkt_number;
+       char total_in_sequence;
+       char route_data[9];
+};
 
-typedef struct FORM_ROUTE_REQ   FORM_ROUTE_REQ ;
+typedef struct FORM_ROUTE_REQ FORM_ROUTE_REQ;
 struct FORM_ROUTE_REQ {
-                          char   cmd_code ;
-                          char   pkt_number ;
-                          char   total_in_sequence ;
-                          char   route_data[10] ;
-                      } ;
+       char cmd_code;
+       char pkt_number;
+       char total_in_sequence;
+       char route_data[10];
+};
 
 
-typedef struct FORM_ERROR   FORM_ERROR ;
+typedef struct FORM_ERROR FORM_ERROR;
 struct FORM_ERROR {
-                        char   cmd_code ;
-                        char   error_code ;
+       char cmd_code;
+       char error_code;
 
-                    } ;
+};
 
-typedef struct FORM_STATUS   FORM_STATUS ;
+typedef struct FORM_STATUS FORM_STATUS;
 struct FORM_STATUS {
-                        char   cmd_code ;
-                        char   status_code ;
-                        char   last_packet_valid ;
-                        char   tx_buffer ;
-                        char   rx_buffer ;
-                        char   port_status ;
-                        char   phb_status ;
-                    } ;
+       char cmd_code;
+       char status_code;
+       char last_packet_valid;
+       char tx_buffer;
+       char rx_buffer;
+       char port_status;
+       char phb_status;
+};
 
 
-typedef struct FORM_LINK_STATUS   FORM_LINK_STATUS ;
+typedef struct FORM_LINK_STATUS FORM_LINK_STATUS;
 struct FORM_LINK_STATUS {
-                        char    cmd_code ;
-                        char    status_code ;
-                        char    link_number ;
-                        ushort  rx_errors ;
-                        ushort  tx_errors ;
-                        ushort  csum_errors ;
-                        ushort  disconnects ;
-                    } ;
+       char cmd_code;
+       char status_code;
+       char link_number;
+       ushort rx_errors;
+       ushort tx_errors;
+       ushort csum_errors;
+       ushort disconnects;
+};
 
 
 
-typedef struct FORM_PARTITION FORM_PARTITION ;
+typedef struct FORM_PARTITION FORM_PARTITION;
 struct FORM_PARTITION {
-                        char    cmd_code ;
-                        char    status_code ;
-                        char    port_number ;
-                        char    tx_max ;
-                        char    rx_max ;
-                        char    rx_limit ;
-                      } ;
+       char cmd_code;
+       char status_code;
+       char port_number;
+       char tx_max;
+       char rx_max;
+       char rx_limit;
+};
 
 
 #endif
 
 /*********** end of file ***********/
-
index 01987c6dc398d8791af4e2c23c61aedef16f70b3..b4778410ec6ebe5c861c81ea640baa10d18a1c77 100644 (file)
@@ -47,20 +47,19 @@ int RIOBootCodeHOST(struct rio_info *, register struct DownLoad *);
 int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *);
 void msec_timeout(struct Host *);
 int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *);
-int RIOBootOk(struct rio_info *,struct Host *, ulong);
-int RIORtaBound(struct rio_info *, uint); 
+int RIOBootOk(struct rio_info *, struct Host *, ulong);
+int RIORtaBound(struct rio_info *, uint);
 void FillSlot(int, int, uint, struct Host *);
 
 /* riocmd.c */
 int RIOFoadRta(struct Host *, struct Map *);
 int RIOZombieRta(struct Host *, struct Map *);
-int RIOCommandRta(struct rio_info *, uint, int (* func)( struct Host *, 
-                                                               struct Map *));
-int RIOIdentifyRta(struct rio_info *, caddr_t); 
+int RIOCommandRta(struct rio_info *, uint, int (*func) (struct Host *, struct Map *));
+int RIOIdentifyRta(struct rio_info *, caddr_t);
 int RIOKillNeighbour(struct rio_info *, caddr_t);
 int RIOSuspendBootRta(struct Host *, int, int);
 int RIOFoadWakeup(struct rio_info *);
-struct CmdBlk * RIOGetCmdBlk(void);
+struct CmdBlk *RIOGetCmdBlk(void);
 void RIOFreeCmdBlk(struct CmdBlk *);
 int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *);
 void RIOPollHostCommands(struct rio_info *, struct Host *);
@@ -71,13 +70,13 @@ void ShowPacket(uint, struct PKT *);
 
 /* rioctrl.c */
 int copyin(int, caddr_t, int);
-int riocontrol(struct rio_info *, dev_t,int,caddr_t,int); 
-int RIOPreemptiveCmd(struct rio_info *,struct Port *,uchar);
+int riocontrol(struct rio_info *, dev_t, int, caddr_t, int);
+int RIOPreemptiveCmd(struct rio_info *, struct Port *, uchar);
 
 /* rioinit.c */
 void rioinit(struct rio_info *, struct RioHostInfo *);
 void RIOInitHosts(struct rio_info *, struct RioHostInfo *);
-void RIOISAinit(struct rio_info *,int);
+void RIOISAinit(struct rio_info *, int);
 int RIODoAT(struct rio_info *, int, int);
 caddr_t RIOCheckForATCard(int);
 int RIOAssignAT(struct rio_info *, int, caddr_t, int);
@@ -85,7 +84,7 @@ int RIOBoardTest(paddr_t, caddr_t, uchar, int);
 void RIOAllocDataStructs(struct rio_info *);
 void RIOSetupDataStructs(struct rio_info *);
 int RIODefaultName(struct rio_info *, struct Host *, uint);
-struct rioVersion * RIOVersid(void);
+struct rioVersion *RIOVersid(void);
 int RIOMapin(paddr_t, int, caddr_t *);
 void RIOMapout(paddr_t, long, caddr_t);
 void RIOHostReset(uint, volatile struct DpRam *, uint);
@@ -108,7 +107,7 @@ void remove_receive(struct Port *);
 
 /* rioroute.c */
 int RIORouteRup(struct rio_info *, uint, struct Host *, struct PKT *);
-void RIOFixPhbs(struct rio_info *, struct Host *, uint); 
+void RIOFixPhbs(struct rio_info *, struct Host *, uint);
 uint GetUnitType(uint);
 int RIOSetChange(struct rio_info *);
 int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *);
@@ -116,9 +115,9 @@ int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *);
 
 /* riotty.c */
 
-int riotopen(struct tty_struct * tty, struct file * filp);
-int riotclose(void  *ptr);
-int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t); 
+int riotopen(struct tty_struct *tty, struct file *filp);
+int riotclose(void *ptr);
+int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t);
 void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg);
 
 /* riotable.c */
@@ -127,27 +126,27 @@ int RIOApel(struct rio_info *);
 int RIODeleteRta(struct rio_info *, struct Map *);
 int RIOAssignRta(struct rio_info *, struct Map *);
 int RIOReMapPorts(struct rio_info *, struct Host *, struct Map *);
-int RIOChangeName(struct rio_info *, struct Map*);
+int RIOChangeName(struct rio_info *, struct Map *);
 
 #if 0
 /* riodrvr.c */
-struct rio_info * rio_install(struct RioHostInfo *);
+struct rio_info *rio_install(struct RioHostInfo *);
 int rio_uninstall(register struct rio_info *);
 int rio_open(struct rio_info *, int, struct file *);
 int rio_close(struct rio_info *, struct file *);
 int rio_read(struct rio_info *, struct file *, char *, int);
-int rio_write(struct rio_info *, struct file * f, char *, int);
+int rio_write(struct rio_info *, struct file *f, char *, int);
 int rio_ioctl(struct rio_info *, struct file *, int, char *);
-int rio_select(struct rio_info *, struct file *        f, int, struct sel *);
-int    rio_intr(char *);
-int rio_isr_thread(char  *);
-struct rio_info * rio_info_store( int cmd, struct rio_info * p);
+int rio_select(struct rio_info *, struct file *f, int, struct sel *);
+int rio_intr(char *);
+int rio_isr_thread(char *);
+struct rio_info *rio_info_store(int cmd, struct rio_info *p);
 #endif
 
-extern int    rio_pcicopy(char *src, char *dst, int n);
-extern int rio_minor (struct tty_struct *tty);
-extern int rio_ismodem (struct tty_struct *tty);
+extern int rio_pcicopy(char *src, char *dst, int n);
+extern int rio_minor(struct tty_struct *tty);
+extern int rio_ismodem(struct tty_struct *tty);
 
-extern void rio_start_card_running (struct Host * HostP);
+extern void rio_start_card_running(struct Host *HostP);
 
-#endif /* __func_h_def */
+#endif                         /* __func_h_def */
index 4c65963870a44a2206b728f4445cf08358e68ffa..f7dfcedf7d45414dfb14c1ea08a6a8a5afcb196e 100644 (file)
@@ -49,33 +49,32 @@ static char *_host_h_sccs_ = "@(#)host.h    1.2";
 **    Host data structure. This is used for the software equiv. of
 **    the host.
 */
-struct    Host
-{
-    uchar                  Type;      /* RIO_EISA, RIO_MCA, ... */
-    uchar                  Ivec;      /* POLLED or ivec number */
-    uchar                  Mode;      /* Control stuff */
-    uchar                   Slot;      /* Slot */
-    volatile caddr_t        Caddr;     /* KV address of DPRAM */
-    volatile struct DpRam  *CardP;     /* KV address of DPRAM, with overlay */
-    paddr_t                PaddrP;    /* Phys. address of DPRAM */
-    char                    Name[MAX_NAME_LEN];  /* The name of the host */
-    uint                   UniqueNum; /* host unique number */
-    spinlock_t             HostLock;  /* Lock structure for MPX */
-    /*struct pci_devinfo    PciDevInfo; *//* PCI Bus/Device/Function stuff */
-    /*struct lockb         HostLock;  *//* Lock structure for MPX */
-    uint                    WorkToBeDone; /* set to true each interrupt */
-    uint                    InIntr;    /* Being serviced? */
-    uint                    IntSrvDone;/* host's interrupt has been serviced */
-    int                            (*Copy)( caddr_t, caddr_t, int ); /* copy func */
-    struct timer_list timer;
-    /*
-    **               I M P O R T A N T !
-    **
-    ** The rest of this data structure is cleared to zero after
-    ** a RIO_HOST_FOAD command.
-    */
-    
-    ulong                   Flags;     /* Whats going down */
+struct Host {
+       uchar Type;             /* RIO_EISA, RIO_MCA, ... */
+       uchar Ivec;             /* POLLED or ivec number */
+       uchar Mode;             /* Control stuff */
+       uchar Slot;             /* Slot */
+       volatile caddr_t Caddr; /* KV address of DPRAM */
+       volatile struct DpRam *CardP;   /* KV address of DPRAM, with overlay */
+       paddr_t PaddrP;         /* Phys. address of DPRAM */
+       char Name[MAX_NAME_LEN];        /* The name of the host */
+       uint UniqueNum;         /* host unique number */
+       spinlock_t HostLock;    /* Lock structure for MPX */
+       /*struct pci_devinfo    PciDevInfo; *//* PCI Bus/Device/Function stuff */
+       /*struct lockb          HostLock;  *//* Lock structure for MPX */
+       uint WorkToBeDone;      /* set to true each interrupt */
+       uint InIntr;            /* Being serviced? */
+       uint IntSrvDone;        /* host's interrupt has been serviced */
+       int (*Copy) (caddr_t, caddr_t, int);    /* copy func */
+       struct timer_list timer;
+       /*
+        **               I M P O R T A N T !
+        **
+        ** The rest of this data structure is cleared to zero after
+        ** a RIO_HOST_FOAD command.
+        */
+
+       ulong Flags;            /* Whats going down */
 #define RC_WAITING            0
 #define RC_STARTUP            1
 #define RC_RUNNING            2
@@ -93,25 +92,25 @@ struct    Host
 #define RC_BOOT_OWN           0x10     /* Only boot RTAs bound to this system */
 #define RC_BOOT_NONE          0x20     /* Don't boot any RTAs (slave mode) */
 
-    struct Top             Topology[LINKS_PER_UNIT]; /* one per link */
-    struct Map              Mapping[MAX_RUP];     /* Mappings for host */
-    struct PHB             *PhbP;                /* Pointer to the PHB array */
-    ushort                 *PhbNumP;             /* Ptr to Number of PHB's */
-    struct LPB                     *LinkStrP ;           /* Link Structure Array */
-    struct RUP             *RupP;                /* Sixteen real rups here */
-    struct PARM_MAP        *ParmMapP;            /* points to the parmmap */
-    uint                    ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */
-    uint                    NumExtraBooted;       /* how many of the above */
-    /*
-    ** Twenty logical rups.
-    ** The first sixteen are the real Rup entries (above), the last four
-    ** are the link RUPs.
-    */
-    struct UnixRup         UnixRups[MAX_RUP+LINKS_PER_UNIT];
-       int                             timeout_id;     /* For calling 100 ms delays */
-       int                             timeout_sem;/* For calling 100 ms delays */
-    long locks; /* long req'd for set_bit --RR */
-    char                   ____end_marker____;
+       struct Top Topology[LINKS_PER_UNIT];    /* one per link */
+       struct Map Mapping[MAX_RUP];    /* Mappings for host */
+       struct PHB *PhbP;       /* Pointer to the PHB array */
+       ushort *PhbNumP;        /* Ptr to Number of PHB's */
+       struct LPB *LinkStrP;   /* Link Structure Array */
+       struct RUP *RupP;       /* Sixteen real rups here */
+       struct PARM_MAP *ParmMapP;      /* points to the parmmap */
+       uint ExtraUnits[MAX_EXTRA_UNITS];       /* unknown things */
+       uint NumExtraBooted;    /* how many of the above */
+       /*
+        ** Twenty logical rups.
+        ** The first sixteen are the real Rup entries (above), the last four
+        ** are the link RUPs.
+        */
+       struct UnixRup UnixRups[MAX_RUP + LINKS_PER_UNIT];
+       int timeout_id;         /* For calling 100 ms delays */
+       int timeout_sem;        /* For calling 100 ms delays */
+       long locks;             /* long req'd for set_bit --RR */
+       char ____end_marker____;
 };
 #define Control      CardP->DpControl
 #define SetInt       CardP->DpSetInt
@@ -129,6 +128,6 @@ struct    Host
 #define Year         CardP->DpYear
 #define Week         CardP->DpWeek
 
-#define RIO_DUMBPARM 0x0860    /* what not to expect */
+#define RIO_DUMBPARM 0x0860    /* what not to expect */
 
 #endif
index f6f31ece6e323b8fd761f7f382122839de67fea8..6281fe47f4e9b19a0fc419e7f764071583383d48 100644 (file)
@@ -37,7 +37,7 @@
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_hosthw_h_sccs = "@(#)hosthw.h        1.2" ;
+static char *_rio_hosthw_h_sccs = "@(#)hosthw.h        1.2";
 #endif
 #endif
 
@@ -53,5 +53,3 @@ static char *_rio_hosthw_h_sccs = "@(#)hosthw.h       1.2" ;
 
 
 /*********** end of file ***********/
-
-
index 972250348f4ad7d583762ce91166dbdffea939a9..bfba5b0c033e89f871dfe08b3ece5e6de6fba1f7 100644 (file)
 #define  DIE_NOW               (ushort) 0x0200
 
 /* Boot request stuff */
-#define BOOT_REQUEST       ((ushort) 0)    /* Request for a boot */
-#define BOOT_ABORT         ((ushort) 1)    /* Abort a boot */
-#define BOOT_SEQUENCE      ((ushort) 2)    /* Packet with the number of packets
-                                              and load address */
-#define BOOT_COMPLETED     ((ushort) 3)    /* Boot completed */
+#define BOOT_REQUEST       ((ushort) 0)        /* Request for a boot */
+#define BOOT_ABORT         ((ushort) 1)        /* Abort a boot */
+#define BOOT_SEQUENCE      ((ushort) 2)        /* Packet with the number of packets
+                                          and load address */
+#define BOOT_COMPLETED     ((ushort) 3)        /* Boot completed */
 
 /* States that a link can be in */
-#define        LINK_DISCONNECTED  ((ushort) 0)    /* Disconnected */
-#define LINK_BOOT1         ((ushort) 1)    /* Trying to send 1st stage boot */
-#define LINK_BOOT2         ((ushort) 2)    /* Trying to send 2nd stage boot */
-#define LINK_BOOT2WAIT     ((ushort) 3)    /* Waiting for selftest results */
-#define LINK_BOOT3         ((ushort) 4)    /* Trying to send 3rd stage boots */
-#define LINK_SYNC          ((ushort) 5)    /* Syncing */
+#define        LINK_DISCONNECTED  ((ushort) 0) /* Disconnected */
+#define LINK_BOOT1         ((ushort) 1)        /* Trying to send 1st stage boot */
+#define LINK_BOOT2         ((ushort) 2)        /* Trying to send 2nd stage boot */
+#define LINK_BOOT2WAIT     ((ushort) 3)        /* Waiting for selftest results */
+#define LINK_BOOT3         ((ushort) 4)        /* Trying to send 3rd stage boots */
+#define LINK_SYNC          ((ushort) 5)        /* Syncing */
 
-#define LINK_INTRO         ((ushort) 10)    /* Introductory packet */
-#define LINK_SUPPLYID      ((ushort) 11)    /* Trying to supply an ID */
-#define LINK_TOPOLOGY      ((ushort) 12)    /* Send a topology update */
-#define LINK_REQUESTID     ((ushort) 13)    /* Waiting for an ID */
-#define LINK_CONNECTED     ((ushort) 14)    /* Connected */
+#define LINK_INTRO         ((ushort) 10)       /* Introductory packet */
+#define LINK_SUPPLYID      ((ushort) 11)       /* Trying to supply an ID */
+#define LINK_TOPOLOGY      ((ushort) 12)       /* Send a topology update */
+#define LINK_REQUESTID     ((ushort) 13)       /* Waiting for an ID */
+#define LINK_CONNECTED     ((ushort) 14)       /* Connected */
 
-#define LINK_INTERCONNECT  ((ushort) 20)   /* Subnets interconnected */
+#define LINK_INTERCONNECT  ((ushort) 20)       /* Subnets interconnected */
 
 #define LINK_SPARE        ((ushort) 40)
 
 ** LED stuff
 */
 #if defined(RTA)
-#define LED_OFF            ((ushort) 0)    /* LED off */
-#define LED_RED            ((ushort) 1)    /* LED Red */
-#define LED_GREEN          ((ushort) 2)    /* LED Green */
-#define LED_ORANGE         ((ushort) 4)    /* LED Orange */
-#define LED_1TO8_OPEN      ((ushort) 1)    /* Port 1->8 LED on */
-#define LED_9TO16_OPEN     ((ushort) 2)    /* Port 9->16 LED on */
+#define LED_OFF            ((ushort) 0)        /* LED off */
+#define LED_RED            ((ushort) 1)        /* LED Red */
+#define LED_GREEN          ((ushort) 2)        /* LED Green */
+#define LED_ORANGE         ((ushort) 4)        /* LED Orange */
+#define LED_1TO8_OPEN      ((ushort) 1)        /* Port 1->8 LED on */
+#define LED_9TO16_OPEN     ((ushort) 2)        /* Port 9->16 LED on */
 #define LED_SET_COLOUR(colour) (link->led = (colour))
 #define LED_OR_COLOUR(colour)  (link->led |= (colour))
 #define LED_TIMEOUT(time)    (link->led_timeout = RioTimePlus(RioTime(),(time)))
 #define LED_SET_COLOUR(colour)
 #define LED_OR_COLOUR(colour)
 #define LED_TIMEOUT(time)
-#endif /* RTA */
+#endif                         /* RTA */
 
 struct LPB {
-               WORD          link_number ;       /* Link Number */
-               Channel_ptr   in_ch ;             /* Link In Channel */
-               Channel_ptr   out_ch ;            /* Link Out Channel */
+       WORD link_number;       /* Link Number */
+       Channel_ptr in_ch;      /* Link In Channel */
+       Channel_ptr out_ch;     /* Link Out Channel */
 #ifdef RTA
-               uchar        stat_led ;          /* Port open leds */
-               uchar        led ;               /* True, light led! */
+       uchar stat_led;         /* Port open leds */
+       uchar led;              /* True, light led! */
 #endif
-               BYTE attached_serial[4]; /* Attached serial number */
-               BYTE attached_host_serial[4];
-                                                 /* Serial number of Host who
-                                                    booted the other end */
-               WORD          descheduled ;       /* Currently Descheduled */
-               WORD          state;              /* Current state */
-               WORD          send_poll ;         /* Send a Poll Packet */
-               Process_ptr   ltt_p ;             /* Process Descriptor */
-               Process_ptr   lrt_p ;             /* Process Descriptor */
-               WORD          lrt_status ;        /* Current lrt status */
-               WORD          ltt_status ;        /* Current ltt status */
-               WORD          timeout ;           /* Timeout value */
-               WORD          topology;           /* Topology bits */
-               WORD          mon_ltt ;
-               WORD          mon_lrt ;
-               WORD          WaitNoBoot ;       /* Secs to hold off booting */
-               PKT_ptr       add_packet_list;    /* Add packets to here */
-               PKT_ptr       remove_packet_list; /* Send packets from here */
+       BYTE attached_serial[4];        /* Attached serial number */
+       BYTE attached_host_serial[4];
+       /* Serial number of Host who
+          booted the other end */
+       WORD descheduled;       /* Currently Descheduled */
+       WORD state;             /* Current state */
+       WORD send_poll;         /* Send a Poll Packet */
+       Process_ptr ltt_p;      /* Process Descriptor */
+       Process_ptr lrt_p;      /* Process Descriptor */
+       WORD lrt_status;        /* Current lrt status */
+       WORD ltt_status;        /* Current ltt status */
+       WORD timeout;           /* Timeout value */
+       WORD topology;          /* Topology bits */
+       WORD mon_ltt;
+       WORD mon_lrt;
+       WORD WaitNoBoot;        /* Secs to hold off booting */
+       PKT_ptr add_packet_list;        /* Add packets to here */
+       PKT_ptr remove_packet_list;     /* Send packets from here */
 #ifdef RTA
 #ifdef DCIRRUS
-#define    QBUFS_PER_REDIRECT (4 / PKTS_PER_BUFFER + 1) 
+#define    QBUFS_PER_REDIRECT (4 / PKTS_PER_BUFFER + 1)
 #else
-#define    QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1) 
+#define    QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1)
 #endif
-               PKT_ptr_ptr   rd_add ;            /* Add a new Packet here */
-               Q_BUF_ptr     rd_add_qb;          /* Pointer to the add Q buf */
-               PKT_ptr_ptr   rd_add_st_qbb ;     /* Pointer to start of the Q's buf */
-               PKT_ptr_ptr   rd_add_end_qbb ;    /* Pointer to the end of the Q's buf */
-               PKT_ptr_ptr   rd_remove ;         /* Remove a Packet here */
-               Q_BUF_ptr     rd_remove_qb ;      /* Pointer to the remove Q buf */
-               PKT_ptr_ptr   rd_remove_st_qbb ;  /* Pointer to the start of the Q buf */
-               PKT_ptr_ptr   rd_remove_end_qbb ; /* Pointer to the end of the Q buf */
-               ushort        pkts_in_q ;         /* Packets in queue */
+       PKT_ptr_ptr rd_add;     /* Add a new Packet here */
+       Q_BUF_ptr rd_add_qb;    /* Pointer to the add Q buf */
+       PKT_ptr_ptr rd_add_st_qbb;      /* Pointer to start of the Q's buf */
+       PKT_ptr_ptr rd_add_end_qbb;     /* Pointer to the end of the Q's buf */
+       PKT_ptr_ptr rd_remove;  /* Remove a Packet here */
+       Q_BUF_ptr rd_remove_qb; /* Pointer to the remove Q buf */
+       PKT_ptr_ptr rd_remove_st_qbb;   /* Pointer to the start of the Q buf */
+       PKT_ptr_ptr rd_remove_end_qbb;  /* Pointer to the end of the Q buf */
+       ushort pkts_in_q;       /* Packets in queue */
 #endif
 
-               Channel_ptr   lrt_fail_chan ;     /* Lrt's failure channel */
-               Channel_ptr   ltt_fail_chan ;     /* Ltt's failure channel */
+       Channel_ptr lrt_fail_chan;      /* Lrt's failure channel */
+       Channel_ptr ltt_fail_chan;      /* Ltt's failure channel */
 
 #if defined (HOST) || defined (INKERNEL)
- /* RUP structure for HOST to driver communications */
-               struct RUP           rup ;              
      /* RUP structure for HOST to driver communications */
+       struct RUP rup;
 #endif
-               struct RUP           link_rup;           /* RUP for the link (POLL,
-                                                    topology etc.) */
-               WORD          attached_link ;     /* Number of attached link */
-               WORD          csum_errors ;       /* csum errors */
-               WORD          num_disconnects ;   /* number of disconnects */
-               WORD          num_sync_rcvd ;     /* # sync's received */
-               WORD          num_sync_rqst ;     /* # sync requests */
-               WORD          num_tx ;            /* Num pkts sent */
-               WORD          num_rx ;            /* Num pkts received */
-               WORD          module_attached;    /* Module tpyes of attached */
-               WORD          led_timeout;        /* LED timeout */
-               WORD          first_port;         /* First port to service */
-               WORD          last_port;          /* Last port to service */
-           } ;
+       struct RUP link_rup;    /* RUP for the link (POLL,
+                                  topology etc.) */
+       WORD attached_link;     /* Number of attached link */
+       WORD csum_errors;       /* csum errors */
+       WORD num_disconnects;   /* number of disconnects */
+       WORD num_sync_rcvd;     /* # sync's received */
+       WORD num_sync_rqst;     /* # sync requests */
+       WORD num_tx;            /* Num pkts sent */
+       WORD num_rx;            /* Num pkts received */
+       WORD module_attached;   /* Module tpyes of attached */
+       WORD led_timeout;       /* LED timeout */
+       WORD first_port;        /* First port to service */
+       WORD last_port;         /* Last port to service */
+};
 
 #endif
 
index d53843abe02d70ecb35fcd7df4eff52418330b76..17a14c4a34200f9e02a50da56de51c2b10d90d3b 100644 (file)
@@ -41,7 +41,7 @@
 #endif
 
 struct ttystatics {
-  struct termios tm;
+       struct termios tm;
 };
 
 #define bzero(d, n)         memset((d), 0, (n))
@@ -97,26 +97,24 @@ the older driver. The older driver includes "brates.h" which shadows
 the definitions from Linux, and is incompatible... */
 
 /* RxBaud and TxBaud definitions... */
-#define        RIO_B0                  0x00                    /* RTS / DTR signals dropped */
-#define        RIO_B50                 0x01                    /* 50 baud */
-#define        RIO_B75                 0x02                    /* 75 baud */
-#define        RIO_B110                0x03                    /* 110 baud */
-#define        RIO_B134                0x04                    /* 134.5 baud */
-#define        RIO_B150                0x05                    /* 150 baud */
-#define        RIO_B200                0x06                    /* 200 baud */
-#define        RIO_B300                0x07                    /* 300 baud */
-#define        RIO_B600                0x08                    /* 600 baud */
-#define        RIO_B1200               0x09                    /* 1200 baud */
-#define        RIO_B1800               0x0A                    /* 1800 baud */
-#define        RIO_B2400               0x0B                    /* 2400 baud */
-#define        RIO_B4800               0x0C                    /* 4800 baud */
-#define        RIO_B9600               0x0D                    /* 9600 baud */
-#define        RIO_B19200              0x0E                    /* 19200 baud */
-#define        RIO_B38400              0x0F                    /* 38400 baud */
-#define        RIO_B56000              0x10                    /* 56000 baud */
-#define        RIO_B57600              0x11                    /* 57600 baud */
-#define        RIO_B64000              0x12                    /* 64000 baud */
-#define        RIO_B115200             0x13                    /* 115200 baud */
-#define        RIO_B2000               0x14                    /* 2000 baud */
-
-
+#define        RIO_B0                  0x00    /* RTS / DTR signals dropped */
+#define        RIO_B50                 0x01    /* 50 baud */
+#define        RIO_B75                 0x02    /* 75 baud */
+#define        RIO_B110                0x03    /* 110 baud */
+#define        RIO_B134                0x04    /* 134.5 baud */
+#define        RIO_B150                0x05    /* 150 baud */
+#define        RIO_B200                0x06    /* 200 baud */
+#define        RIO_B300                0x07    /* 300 baud */
+#define        RIO_B600                0x08    /* 600 baud */
+#define        RIO_B1200               0x09    /* 1200 baud */
+#define        RIO_B1800               0x0A    /* 1800 baud */
+#define        RIO_B2400               0x0B    /* 2400 baud */
+#define        RIO_B4800               0x0C    /* 4800 baud */
+#define        RIO_B9600               0x0D    /* 9600 baud */
+#define        RIO_B19200              0x0E    /* 19200 baud */
+#define        RIO_B38400              0x0F    /* 38400 baud */
+#define        RIO_B56000              0x10    /* 56000 baud */
+#define        RIO_B57600              0x11    /* 57600 baud */
+#define        RIO_B64000              0x12    /* 64000 baud */
+#define        RIO_B115200             0x13    /* 115200 baud */
+#define        RIO_B2000               0x14    /* 2000 baud */
index a4f7f1f562558fcc109c1cc012c8651932a21c0f..36aad4c9cb3a2539f85074873ca480c921f67262 100644 (file)
@@ -38,7 +38,7 @@
 
 #ifdef SCCS_LABELS
 #ifndef lint
-static char *_rio_list_h_sccs = "@(#)list.h    1.9" ;
+static char *_rio_list_h_sccs = "@(#)list.h    1.9";
 #endif
 #endif
 
@@ -166,7 +166,7 @@ static char *_rio_list_h_sccs = "@(#)list.h 1.9" ;
 #endif
 
 
-#else /* !IN_KERNEL */
+#else                          /* !IN_KERNEL */
 
 #define ZERO_PTR NULL
 
@@ -192,5 +192,5 @@ static char *_rio_list_h_sccs = "@(#)list.h 1.9" ;
 #define splx(oldspl)    if ((oldspl) == 0) spl0()
 #endif
 
-#endif /* ifndef _list.h */
+#endif                         /* ifndef _list.h */
 /*********** end of file ***********/
index bbac8fa18feeddb20f7a9b785fdc7d6ef5600ddf..b41764d7a22a1a17ac784b3344c14a36a0b8ff91 100644 (file)
@@ -36,7 +36,7 @@
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_lrt_h_sccs = "@(#)lrt.h      1.1" ;
+static char *_rio_lrt_h_sccs = "@(#)lrt.h      1.1";
 #endif
 #endif
 
@@ -50,6 +50,3 @@ static char *_rio_lrt_h_sccs = "@(#)lrt.h     1.1" ;
 
 
 /*********** end of file ***********/
-
-
-
index f27dcecf03ca9654e5914bbdba5ff0fcfa74fb4a..ab04004d4048c08cc30db335d40c21be3726d967 100644 (file)
@@ -36,7 +36,7 @@
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_ltt_h_sccs = "@(#)ltt.h      1.1" ;
+static char *_rio_ltt_h_sccs = "@(#)ltt.h      1.1";
 #endif
 #endif
 
@@ -45,11 +45,8 @@ static char *_rio_ltt_h_sccs = "@(#)ltt.h    1.1" ;
 #else
 #define LTT_STACK       (ushort) 200
 #endif
 
 
 
-/*********** end of file ***********/
-
-
 
+/*********** end of file ***********/
index fe17d0ee4933dc75cdc1606f50247ec428829398..fdf0c1f250ab20b9d7f3b423a2feecb5fe3c59ab 100644 (file)
@@ -39,7 +39,7 @@
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_lttwake_h_sccs = "@(#)lttwake.h      1.1" ;
+static char *_rio_lttwake_h_sccs = "@(#)lttwake.h      1.1";
 #endif
 #endif
 
@@ -48,6 +48,3 @@ static char *_rio_lttwake_h_sccs = "@(#)lttwake.h     1.1" ;
 
 
 /*********** end of file ***********/
-
-
-
index 400645a1ff2858c1f64d0acef0c4ec12fdabecc8..97fe287aab2ad70c9e709cf5c4b4c516d15add8f 100644 (file)
@@ -46,21 +46,20 @@ static char *_map_h_sccs_ = "@(#)map.h      1.2";
 #define        TOTAL_MAP_ENTRIES (MAX_MAP_ENTRY*RIO_SLOTS)
 #define        MAX_NAME_LEN 32
 
-struct Map
-{
-       uint    HostUniqueNum;          /* Supporting hosts unique number */
-       uint    RtaUniqueNum;           /* Unique number */
+struct Map {
+       uint HostUniqueNum;     /* Supporting hosts unique number */
+       uint RtaUniqueNum;      /* Unique number */
        /*
-       ** The next two IDs must be swapped on big-endian architectures
-       ** when using a v2.04 /etc/rio/config with a v3.00 driver (when
-       ** upgrading for example).
-       */
-       ushort  ID;                     /* ID used in the subnet */
-       ushort  ID2;                    /* ID of 2nd block of 8 for 16 port */
-       ulong   Flags;                  /* Booted, ID Given, Disconnected */
-       ulong   SysPort;                /* First tty mapped to this port */
-       struct Top   Topology[LINKS_PER_UNIT];  /* ID connected to each link */
-       char    Name[MAX_NAME_LEN];        /* Cute name by which RTA is known */
+        ** The next two IDs must be swapped on big-endian architectures
+        ** when using a v2.04 /etc/rio/config with a v3.00 driver (when
+        ** upgrading for example).
+        */
+       ushort ID;              /* ID used in the subnet */
+       ushort ID2;             /* ID of 2nd block of 8 for 16 port */
+       ulong Flags;            /* Booted, ID Given, Disconnected */
+       ulong SysPort;          /* First tty mapped to this port */
+       struct Top Topology[LINKS_PER_UNIT];    /* ID connected to each link */
+       char Name[MAX_NAME_LEN];        /* Cute name by which RTA is known */
 };
 
 /*
index 08a327e473af928fda8d4a6735c0b964705821e0..d01e76be7a17be2bd1e0866950d6f4fc87ea40a3 100644 (file)
@@ -70,4 +70,4 @@ static char *_mca_h_sccs_ = "@(#)mca.h        1.2";
 
 #define        RIO_MCA_DEFAULT_MODE    SLOW_LINKS
 
-#endif /* __rio_mca_h__ */
+#endif                         /* __rio_mca_h__ */
index 9cf6c0bacea49752989ff8b242d843d08eaf3024..dd9be586ec6fd39c020937133030a9074efb4433 100644 (file)
@@ -38,4 +38,4 @@ static char *_mesg_h_sccs_ = "@(#)mesg.h      1.2";
 #endif
 
 
-#endif /* __rio_mesg_h__ */
+#endif                         /* __rio_mesg_h__ */
index 2dc30b9aab37f24d3c6da65d0f808afeb93b29a5..de7e57180c91f2f9137a28ef393de4a252c7df08 100644 (file)
@@ -42,20 +42,19 @@ static char *_param_h_sccs_ = "@(#)param.h  1.2";
 ** the param command block, as used in OPEN and PARAM calls.
 */
 
-struct phb_param
-{
-    BYTE    Cmd;        /* It is very important that these line up */
-    BYTE    Cor1;       /* with what is expected at the other end. */
-    BYTE    Cor2;       /* to confirm that you've got it right,    */
-    BYTE    Cor4;       /* check with cirrus/cirrus.h              */
-    BYTE    Cor5;
-    BYTE    TxXon;     /* Transmit X-On character */
-    BYTE    TxXoff;    /* Transmit X-Off character */
-    BYTE    RxXon;     /* Receive X-On character */
-    BYTE    RxXoff;    /* Receive X-Off character */
-    BYTE    LNext;     /* Literal-next character */
-    BYTE    TxBaud;    /* Transmit baudrate */
-    BYTE    RxBaud;    /* Receive baudrate */
+struct phb_param {
+       BYTE Cmd;               /* It is very important that these line up */
+       BYTE Cor1;              /* with what is expected at the other end. */
+       BYTE Cor2;              /* to confirm that you've got it right,    */
+       BYTE Cor4;              /* check with cirrus/cirrus.h              */
+       BYTE Cor5;
+       BYTE TxXon;             /* Transmit X-On character */
+       BYTE TxXoff;            /* Transmit X-Off character */
+       BYTE RxXon;             /* Receive X-On character */
+       BYTE RxXoff;            /* Receive X-Off character */
+       BYTE LNext;             /* Literal-next character */
+       BYTE TxBaud;            /* Transmit baudrate */
+       BYTE RxBaud;            /* Receive baudrate */
 };
 
 #endif
index 46f99dfdac8d3c2f03c0a30110b289f097f148ab..fe4e00567065150d84e3aa3cb190caa936acdf21 100644 (file)
 #endif
 #endif
 
-typedef struct PARM_MAP PARM_MAP ;
+typedef struct PARM_MAP PARM_MAP;
 
-struct PARM_MAP
-{
-PHB_ptr           phb_ptr ;              /* Pointer to the PHB array */
-WORD_ptr          phb_num_ptr ;          /* Ptr to Number of PHB's */
-FREE_LIST_ptr     free_list;             /* Free List pointer */
-FREE_LIST_ptr     free_list_end;         /* Free List End pointer */
-Q_BUF_ptr_ptr     q_free_list_ptr ;      /* Ptr to Q_BUF variable */
-BYTE_ptr          unit_id_ptr ;          /* Unit Id */
-LPB_ptr           link_str_ptr ;         /* Link Structure Array */
-BYTE_ptr          bootloader_1 ;         /* 1st Stage Boot Loader */
-BYTE_ptr          bootloader_2 ;         /* 2nd Stage Boot Loader */
-WORD_ptr          port_route_map_ptr ;   /* Port Route Map */
-ROUTE_STR_ptr     route_ptr ;            /* Unit Route Map */
-NUMBER_ptr        map_present ;          /* Route Map present */
-NUMBER            pkt_num ;               /* Total number of packets */
-NUMBER            q_num ;                 /* Total number of Q packets */
-WORD              buffers_per_port ;      /* Number of buffers per port */
-WORD              heap_size ;             /* Initial size of heap */
-WORD              heap_left ;             /* Current Heap left */
-WORD              error ;                 /* Error code */
-WORD              tx_max;                 /* Max number of tx pkts per phb */
-WORD              rx_max;                 /* Max number of rx pkts per phb */
-WORD              rx_limit;               /* For high / low watermarks */
-NUMBER            links ;                 /* Links to use */
-NUMBER            timer ;                 /* Interrupts per second */
-RUP_ptr           rups ;                 /* Pointer to the RUPs */
-WORD              max_phb ;              /* Mostly for debugging */
-WORD              living ;               /* Just increments!! */
-WORD              init_done ;            /* Initialisation over */
-WORD              booting_link ;
-WORD              idle_count ;           /* Idle time counter */
-WORD              busy_count ;           /* Busy counter */
-WORD              idle_control ;         /* Control Idle Process */
+struct PARM_MAP {
+       PHB_ptr phb_ptr;        /* Pointer to the PHB array */
+       WORD_ptr phb_num_ptr;   /* Ptr to Number of PHB's */
+       FREE_LIST_ptr free_list;        /* Free List pointer */
+       FREE_LIST_ptr free_list_end;    /* Free List End pointer */
+       Q_BUF_ptr_ptr q_free_list_ptr;  /* Ptr to Q_BUF variable */
+       BYTE_ptr unit_id_ptr;   /* Unit Id */
+       LPB_ptr link_str_ptr;   /* Link Structure Array */
+       BYTE_ptr bootloader_1;  /* 1st Stage Boot Loader */
+       BYTE_ptr bootloader_2;  /* 2nd Stage Boot Loader */
+       WORD_ptr port_route_map_ptr;    /* Port Route Map */
+       ROUTE_STR_ptr route_ptr;        /* Unit Route Map */
+       NUMBER_ptr map_present; /* Route Map present */
+       NUMBER pkt_num;         /* Total number of packets */
+       NUMBER q_num;           /* Total number of Q packets */
+       WORD buffers_per_port;  /* Number of buffers per port */
+       WORD heap_size;         /* Initial size of heap */
+       WORD heap_left;         /* Current Heap left */
+       WORD error;             /* Error code */
+       WORD tx_max;            /* Max number of tx pkts per phb */
+       WORD rx_max;            /* Max number of rx pkts per phb */
+       WORD rx_limit;          /* For high / low watermarks */
+       NUMBER links;           /* Links to use */
+       NUMBER timer;           /* Interrupts per second */
+       RUP_ptr rups;           /* Pointer to the RUPs */
+       WORD max_phb;           /* Mostly for debugging */
+       WORD living;            /* Just increments!! */
+       WORD init_done;         /* Initialisation over */
+       WORD booting_link;
+       WORD idle_count;        /* Idle time counter */
+       WORD busy_count;        /* Busy counter */
+       WORD idle_control;      /* Control Idle Process */
 #if defined(HOST) || defined(INKERNEL)
-WORD              tx_intr;               /* TX interrupt pending */
-WORD              rx_intr;               /* RX interrupt pending */
-WORD              rup_intr;              /* RUP interrupt pending */
+       WORD tx_intr;           /* TX interrupt pending */
+       WORD rx_intr;           /* RX interrupt pending */
+       WORD rup_intr;          /* RUP interrupt pending */
 #endif
 #if defined(RTA)
-WORD             dying_count;          /* Count of processes dead */
+       WORD dying_count;       /* Count of processes dead */
 #endif
-} ;
+};
 
 #endif
 
 /*********** end of file ***********/
-
-
index dc635bd25194ba1afd44cba2d9f195ec8610fc2f..1eba9118079b308203f6b4a968524bc0220483e3 100644 (file)
@@ -73,4 +73,4 @@ static char *_pci_h_sccs_ = "@(#)pci.h        1.2";
 
 #define        RIO_PCI_DEFAULT_MODE    0x05
 
-#endif /* __rio_pci_h__ */
+#endif                         /* __rio_pci_h__ */
index e1483a0e30bd22fac0680a844d908fc780ecd1c4..3baebf8513afe48d27c3803a868c116229a24df6 100644 (file)
 /*************************************************
  * Handshake asserted. Deasserted by the LTT(s)
  ************************************************/
-#define PHB_HANDSHAKE_SET      ((ushort) 0x001) /* Set by LRT */
+#define PHB_HANDSHAKE_SET      ((ushort) 0x001)        /* Set by LRT */
 
-#define PHB_HANDSHAKE_RESET     ((ushort) 0x002) /* Set by ISR / driver */
+#define PHB_HANDSHAKE_RESET     ((ushort) 0x002)       /* Set by ISR / driver */
 
 #define PHB_HANDSHAKE_FLAGS     (PHB_HANDSHAKE_RESET | PHB_HANDSHAKE_SET)
-                                                /* Reset by ltt */
+                                               /* Reset by ltt */
 
 
 /*************************************************
  * Maximum number of PHB's
  ************************************************/
 #if defined (HOST) || defined (INKERNEL)
-#define MAX_PHB               ((ushort) 128)  /* range 0-127 */
+#define MAX_PHB               ((ushort) 128)   /* range 0-127 */
 #else
-#define MAX_PHB               ((ushort) 8)    /* range 0-7 */
+#define MAX_PHB               ((ushort) 8)     /* range 0-7 */
 #endif
 
 /*************************************************
  * Defines for the mode fields
  ************************************************/
-#define TXPKT_INCOMPLETE        0x0001  /* Previous tx packet not completed */
-#define TXINTR_ENABLED          0x0002  /* Tx interrupt is enabled */
-#define TX_TAB3                 0x0004  /* TAB3 mode */
-#define TX_OCRNL                0x0008  /* OCRNL mode */
-#define TX_ONLCR                0x0010  /* ONLCR mode */
-#define TX_SENDSPACES           0x0020  /* Send n spaces command needs 
-                                           completing */
-#define TX_SENDNULL             0x0040  /* Escaping NULL needs completing */
-#define TX_SENDLF               0x0080  /* LF -> CR LF needs completing */
-#define TX_PARALLELBUG          0x0100  /* CD1400 LF -> CR LF bug on parallel
-                                           port */
+#define TXPKT_INCOMPLETE        0x0001 /* Previous tx packet not completed */
+#define TXINTR_ENABLED          0x0002 /* Tx interrupt is enabled */
+#define TX_TAB3                 0x0004 /* TAB3 mode */
+#define TX_OCRNL                0x0008 /* OCRNL mode */
+#define TX_ONLCR                0x0010 /* ONLCR mode */
+#define TX_SENDSPACES           0x0020 /* Send n spaces command needs
+                                          completing */
+#define TX_SENDNULL             0x0040 /* Escaping NULL needs completing */
+#define TX_SENDLF               0x0080 /* LF -> CR LF needs completing */
+#define TX_PARALLELBUG          0x0100 /* CD1400 LF -> CR LF bug on parallel
+                                          port */
 #define TX_HANGOVER             (TX_SENDSPACES | TX_SENDLF | TX_SENDNULL)
 #define TX_DTRFLOW             0x0200  /* DTR tx flow control */
 #define        TX_DTRFLOWED            0x0400  /* DTR is low - don't allow more data
 #define        TX_DATAINFIFO           0x0800  /* There is data in the FIFO */
 #define        TX_BUSY                 0x1000  /* Data in FIFO, shift or holding regs */
 
-#define RX_SPARE               0x0001   /* SPARE */
-#define RXINTR_ENABLED          0x0002   /* Rx interrupt enabled */
-#define RX_ICRNL                0x0008   /* ICRNL mode */
-#define RX_INLCR                0x0010   /* INLCR mode */
-#define RX_IGNCR                0x0020   /* IGNCR mode */
-#define RX_CTSFLOW              0x0040   /* CTSFLOW enabled */
-#define RX_IXOFF                0x0080   /* IXOFF enabled */
-#define RX_CTSFLOWED            0x0100   /* CTSFLOW and CTS dropped */
-#define RX_IXOFFED              0x0200   /* IXOFF and xoff sent */
-#define RX_BUFFERED            0x0400   /* Try and pass on complete packets */
+#define RX_SPARE               0x0001  /* SPARE */
+#define RXINTR_ENABLED          0x0002 /* Rx interrupt enabled */
+#define RX_ICRNL                0x0008 /* ICRNL mode */
+#define RX_INLCR                0x0010 /* INLCR mode */
+#define RX_IGNCR                0x0020 /* IGNCR mode */
+#define RX_CTSFLOW              0x0040 /* CTSFLOW enabled */
+#define RX_IXOFF                0x0080 /* IXOFF enabled */
+#define RX_CTSFLOWED            0x0100 /* CTSFLOW and CTS dropped */
+#define RX_IXOFFED              0x0200 /* IXOFF and xoff sent */
+#define RX_BUFFERED            0x0400  /* Try and pass on complete packets */
 
-#define PORT_ISOPEN             0x0001  /* Port open? */
-#define PORT_HUPCL              0x0002  /* Hangup on close? */
-#define PORT_MOPENPEND          0x0004  /* Modem open pending */
-#define PORT_ISPARALLEL         0x0008  /* Parallel port */
-#define PORT_BREAK              0x0010  /* Port on break */
-#define PORT_STATUSPEND                0x0020  /* Status packet pending */
-#define PORT_BREAKPEND          0x0040  /* Break packet pending */
-#define PORT_MODEMPEND          0x0080  /* Modem status packet pending */
-#define PORT_PARALLELBUG        0x0100  /* CD1400 LF -> CR LF bug on parallel
-                                           port */
-#define PORT_FULLMODEM          0x0200  /* Full modem signals */
-#define PORT_RJ45               0x0400  /* RJ45 connector - no RI signal */
-#define PORT_RESTRICTED         0x0600  /* Restricted connector - no RI / DTR */
+#define PORT_ISOPEN             0x0001 /* Port open? */
+#define PORT_HUPCL              0x0002 /* Hangup on close? */
+#define PORT_MOPENPEND          0x0004 /* Modem open pending */
+#define PORT_ISPARALLEL         0x0008 /* Parallel port */
+#define PORT_BREAK              0x0010 /* Port on break */
+#define PORT_STATUSPEND                0x0020  /* Status packet pending */
+#define PORT_BREAKPEND          0x0040 /* Break packet pending */
+#define PORT_MODEMPEND          0x0080 /* Modem status packet pending */
+#define PORT_PARALLELBUG        0x0100 /* CD1400 LF -> CR LF bug on parallel
+                                          port */
+#define PORT_FULLMODEM          0x0200 /* Full modem signals */
+#define PORT_RJ45               0x0400 /* RJ45 connector - no RI signal */
+#define PORT_RESTRICTED         0x0600 /* Restricted connector - no RI / DTR */
 
-#define PORT_MODEMBITS          0x0600  /* Mask for modem fields */
+#define PORT_MODEMBITS          0x0600 /* Mask for modem fields */
 
-#define PORT_WCLOSE             0x0800  /* Waiting for close */
+#define PORT_WCLOSE             0x0800 /* Waiting for close */
 #define        PORT_HANDSHAKEFIX       0x1000  /* Port has H/W flow control fix */
 #define        PORT_WASPCLOSED         0x2000  /* Port closed with PCLOSE */
 #define        DUMPMODE                0x4000  /* Dump RTA mem */
 #define rx_end       u4.s1.rx_end_ptr_ptr
 #define rx_remove    u4.s1.rx_remove_ptr_ptr
 #endif
-typedef struct PHB PHB ;
+typedef struct PHB PHB;
 struct PHB {
 #ifdef RTA
-        ushort      port;
+       ushort port;
 #endif
 #ifdef INKERNEL
-        WORD      source;
+       WORD source;
 #else
-        union       
-        {
-            ushort source;              /* Complete source */
-            struct
-            {
-                unsigned char unit;     /* Source unit */
-                unsigned char port;     /* Source port */
-            } s2;
-        } u2;
+       union {
+               ushort source;  /* Complete source */
+               struct {
+                       unsigned char unit;     /* Source unit */
+                       unsigned char port;     /* Source port */
+               } s2;
+       } u2;
 #endif
-        WORD      handshake ;
-        WORD      status ;
-        NUMBER       timeout ;           /* Maximum of 1.9 seconds */
-        WORD      link ;              /* Send down this link */
+       WORD handshake;
+       WORD status;
+       NUMBER timeout;         /* Maximum of 1.9 seconds */
+       WORD link;              /* Send down this link */
 #ifdef INKERNEL
-        WORD      destination;
+       WORD destination;
 #else
-        union       
-        {
-            ushort destination;         /* Complete destination */
-            struct
-            {
-                unsigned char unit;     /* Destination unit */
-                unsigned char port;     /* Destination port */
-            } s1;
-        } u1;
+       union {
+               ushort destination;     /* Complete destination */
+               struct {
+                       unsigned char unit;     /* Destination unit */
+                       unsigned char port;     /* Destination port */
+               } s1;
+       } u1;
 #endif
 #ifdef RTA
-        ushort      tx_pkts_added;
-        ushort      tx_pkts_removed;
-        Q_BUF_ptr   tx_q_start ;        /* Start of the Q list chain */
-        short       num_tx_q_bufs ;     /* Number of Q buffers in the chain */
-        PKT_ptr_ptr tx_add ;            /* Add a new Packet here */
-        Q_BUF_ptr   tx_add_qb;          /* Pointer to the add Q buf */
-        PKT_ptr_ptr tx_add_st_qbb ;     /* Pointer to start of the Q's buf */
-        PKT_ptr_ptr tx_add_end_qbb ;    /* Pointer to the end of the Q's buf */
-        PKT_ptr_ptr tx_remove ;         /* Remove a Packet here */
-        Q_BUF_ptr   tx_remove_qb ;      /* Pointer to the remove Q buf */
-        PKT_ptr_ptr tx_remove_st_qbb ;  /* Pointer to the start of the Q buf */
-        PKT_ptr_ptr tx_remove_end_qbb ; /* Pointer to the end of the Q buf */
+       ushort tx_pkts_added;
+       ushort tx_pkts_removed;
+       Q_BUF_ptr tx_q_start;   /* Start of the Q list chain */
+       short num_tx_q_bufs;    /* Number of Q buffers in the chain */
+       PKT_ptr_ptr tx_add;     /* Add a new Packet here */
+       Q_BUF_ptr tx_add_qb;    /* Pointer to the add Q buf */
+       PKT_ptr_ptr tx_add_st_qbb;      /* Pointer to start of the Q's buf */
+       PKT_ptr_ptr tx_add_end_qbb;     /* Pointer to the end of the Q's buf */
+       PKT_ptr_ptr tx_remove;  /* Remove a Packet here */
+       Q_BUF_ptr tx_remove_qb; /* Pointer to the remove Q buf */
+       PKT_ptr_ptr tx_remove_st_qbb;   /* Pointer to the start of the Q buf */
+       PKT_ptr_ptr tx_remove_end_qbb;  /* Pointer to the end of the Q buf */
 #endif
 #ifdef INKERNEL
-        PKT_ptr_ptr tx_start ;
-        PKT_ptr_ptr tx_end ;
-        PKT_ptr_ptr tx_add ;
-        PKT_ptr_ptr tx_remove ;
+       PKT_ptr_ptr tx_start;
+       PKT_ptr_ptr tx_end;
+       PKT_ptr_ptr tx_add;
+       PKT_ptr_ptr tx_remove;
 #endif
 #ifdef HOST
-        union
-        {
-            struct
-            {
-                PKT_ptr_ptr tx_start_ptr_ptr;
-                PKT_ptr_ptr tx_end_ptr_ptr;
-                PKT_ptr_ptr tx_add_ptr_ptr;
-                PKT_ptr_ptr tx_remove_ptr_ptr;
-            } s1;
-            struct
-            {
-                ushort * tx_start_ptr;
-                ushort * tx_end_ptr;
-                ushort * tx_add_ptr;
-                ushort * tx_remove_ptr;
-            } s2;
-        } u3;
+       union {
+               struct {
+                       PKT_ptr_ptr tx_start_ptr_ptr;
+                       PKT_ptr_ptr tx_end_ptr_ptr;
+                       PKT_ptr_ptr tx_add_ptr_ptr;
+                       PKT_ptr_ptr tx_remove_ptr_ptr;
+               } s1;
+               struct {
+                       ushort *tx_start_ptr;
+                       ushort *tx_end_ptr;
+                       ushort *tx_add_ptr;
+                       ushort *tx_remove_ptr;
+               } s2;
+       } u3;
 #endif
 
 #ifdef  RTA
-        ushort      rx_pkts_added;
-        ushort      rx_pkts_removed;
-        Q_BUF_ptr   rx_q_start ;        /* Start of the Q list chain */
-        short       num_rx_q_bufs ;     /* Number of Q buffers in the chain */
-        PKT_ptr_ptr rx_add ;            /* Add a new Packet here */
-        Q_BUF_ptr   rx_add_qb ;         /* Pointer to the add Q buf */
-        PKT_ptr_ptr rx_add_st_qbb ;     /* Pointer to start of the Q's buf */
-        PKT_ptr_ptr rx_add_end_qbb ;    /* Pointer to the end of the Q's buf */
-        PKT_ptr_ptr rx_remove ;         /* Remove a Packet here */
-        Q_BUF_ptr   rx_remove_qb ;      /* Pointer to the remove Q buf */
-        PKT_ptr_ptr rx_remove_st_qbb ;  /* Pointer to the start of the Q buf */
-        PKT_ptr_ptr rx_remove_end_qbb ; /* Pointer to the end of the Q buf */
+       ushort rx_pkts_added;
+       ushort rx_pkts_removed;
+       Q_BUF_ptr rx_q_start;   /* Start of the Q list chain */
+       short num_rx_q_bufs;    /* Number of Q buffers in the chain */
+       PKT_ptr_ptr rx_add;     /* Add a new Packet here */
+       Q_BUF_ptr rx_add_qb;    /* Pointer to the add Q buf */
+       PKT_ptr_ptr rx_add_st_qbb;      /* Pointer to start of the Q's buf */
+       PKT_ptr_ptr rx_add_end_qbb;     /* Pointer to the end of the Q's buf */
+       PKT_ptr_ptr rx_remove;  /* Remove a Packet here */
+       Q_BUF_ptr rx_remove_qb; /* Pointer to the remove Q buf */
+       PKT_ptr_ptr rx_remove_st_qbb;   /* Pointer to the start of the Q buf */
+       PKT_ptr_ptr rx_remove_end_qbb;  /* Pointer to the end of the Q buf */
 #endif
 #ifdef INKERNEL
-        PKT_ptr_ptr rx_start ;
-        PKT_ptr_ptr rx_end ;
-        PKT_ptr_ptr rx_add ;
-        PKT_ptr_ptr rx_remove ;
+       PKT_ptr_ptr rx_start;
+       PKT_ptr_ptr rx_end;
+       PKT_ptr_ptr rx_add;
+       PKT_ptr_ptr rx_remove;
 #endif
 #ifdef HOST
-        union
-        {
-            struct
-            {
-                PKT_ptr_ptr rx_start_ptr_ptr;
-                PKT_ptr_ptr rx_end_ptr_ptr;
-                PKT_ptr_ptr rx_add_ptr_ptr;
-                PKT_ptr_ptr rx_remove_ptr_ptr;
-            } s1;
-            struct
-            {
-                ushort * rx_start_ptr;
-                ushort * rx_end_ptr;
-                ushort * rx_add_ptr;
-                ushort * rx_remove_ptr;
-            } s2;
-        } u4;
+       union {
+               struct {
+                       PKT_ptr_ptr rx_start_ptr_ptr;
+                       PKT_ptr_ptr rx_end_ptr_ptr;
+                       PKT_ptr_ptr rx_add_ptr_ptr;
+                       PKT_ptr_ptr rx_remove_ptr_ptr;
+               } s1;
+               struct {
+                       ushort *rx_start_ptr;
+                       ushort *rx_end_ptr;
+                       ushort *rx_add_ptr;
+                       ushort *rx_remove_ptr;
+               } s2;
+       } u4;
 #endif
 
-#ifdef RTA                              /* some fields for the remotes */
-        ushort     flush_count;                /* Count of write flushes */
-        ushort     txmode;             /* Modes for tx */
-        ushort     rxmode;             /* Modes for rx */
-        ushort     portmode;           /* Generic modes */
-        ushort     column;             /* TAB3 column count */
-        ushort     tx_subscript;       /* (TX) Subscript into data field */
-        ushort     rx_subscript;       /* (RX) Subscript into data field */
-        PKT_ptr    rx_incomplete;      /* Hold an incomplete packet here */
-        ushort     modem_bits;         /* Modem bits to mask */
-       ushort     lastModem;           /* Modem control lines. */
-        ushort     addr;               /* Address for sub commands */
-        ushort     MonitorTstate;      /* TRUE if monitoring tstop */
+#ifdef RTA                     /* some fields for the remotes */
+       ushort flush_count;     /* Count of write flushes */
+       ushort txmode;          /* Modes for tx */
+       ushort rxmode;          /* Modes for rx */
+       ushort portmode;        /* Generic modes */
+       ushort column;          /* TAB3 column count */
+       ushort tx_subscript;    /* (TX) Subscript into data field */
+       ushort rx_subscript;    /* (RX) Subscript into data field */
+       PKT_ptr rx_incomplete;  /* Hold an incomplete packet here */
+       ushort modem_bits;      /* Modem bits to mask */
+       ushort lastModem;       /* Modem control lines. */
+       ushort addr;            /* Address for sub commands */
+       ushort MonitorTstate;   /* TRUE if monitoring tstop */
 #endif
 
-        } ;
+};
 
 #endif
 
 /*********** end of file ***********/
-
index 66bb2ff0f694cf73352df40e3ef58f0ea04447f3..882fd429ac2ef44494da9787cd0fff1b23db9f34 100644 (file)
 #define CONTROL_PKT_TTL_MASK (PKT_TTL_MASK << 8)
 #define CONTROL_DATA_WNDW  (DATA_WNDW << 8)
 
-struct PKT    {
+struct PKT {
 #ifdef INKERNEL
-                   BYTE    dest_unit ;    /* Destination Unit Id */
-                   BYTE    dest_port ;    /* Destination POrt */
-                   BYTE    src_unit ;     /* Source Unit Id */
-                   BYTE    src_port ;     /* Source POrt */
+       BYTE dest_unit;         /* Destination Unit Id */
+       BYTE dest_port;         /* Destination POrt */
+       BYTE src_unit;          /* Source Unit Id */
+       BYTE src_port;          /* Source POrt */
 #else
-                   union       
-                   {
-                       ushort destination;         /* Complete destination */
-                       struct
-                       {
-                           unsigned char unit;     /* Destination unit */
-                           unsigned char port;     /* Destination port */
-                       } s1;
-                   } u1;
-                   union       
-                   {
-                       ushort source;              /* Complete source */
-                       struct
-                       {
-                           unsigned char unit;     /* Source unit */
-                           unsigned char port;     /* Source port */
-                       } s2;
-                   } u2;
+       union {
+               ushort destination;     /* Complete destination */
+               struct {
+                       unsigned char unit;     /* Destination unit */
+                       unsigned char port;     /* Destination port */
+               } s1;
+       } u1;
+       union {
+               ushort source;  /* Complete source */
+               struct {
+                       unsigned char unit;     /* Source unit */
+                       unsigned char port;     /* Source port */
+               } s2;
+       } u2;
 #endif
 #ifdef INKERNEL
-                   BYTE len ;
-                   BYTE control;
+       BYTE len;
+       BYTE control;
 #else
-                   union
-                   {
-                        ushort      control;
-                        struct
-                        {
-                            unsigned char len;
-                            unsigned char control;
-                        } s3;
-                    } u3;
+       union {
+               ushort control;
+               struct {
+                       unsigned char len;
+                       unsigned char control;
+               } s3;
+       } u3;
 #endif
-                   BYTE    data[PKT_MAX_DATA_LEN] ;     
-                                                   /* Actual data :-) */
-                   WORD  csum ;                  /* C-SUM */
-               } ;
+       BYTE data[PKT_MAX_DATA_LEN];
+       /* Actual data :-) */
+       WORD csum;              /* C-SUM */
+};
 #endif
 
 /*********** end of file ***********/
-
-
index d9b8e983e175bc7477bf41f9c50e512b5af0916b..9616ee4c6cd5a8de81a25b1181965199f4e7d237 100644 (file)
@@ -39,7 +39,7 @@
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_poll_h_sccs = "@(#)poll.h    1.2" ;
+static char *_rio_poll_h_sccs = "@(#)poll.h    1.2";
 #endif
 #endif
 
@@ -54,23 +54,20 @@ static char *_rio_poll_h_sccs = "@(#)poll.h 1.2" ;
 #define POLL_PERIOD           (int) SECOND
 
 /* The various poll commands */
-#define POLL_POLL             0            /* We are connected and happy.. */
-#define POLL_INTRO            1            /* Introduction packet */
-#define POLL_TOPOLOGY         2            /* Topology update */
-#define POLL_ASSIGN           3            /* ID assign */
-#define POLL_FOAD             4            /* F*** Off And Die */
-#define POLL_LMD             5            /* Let Me Die */
-#define POLL_DYB             6            /* Die You Ba***** */
+#define POLL_POLL             0        /* We are connected and happy.. */
+#define POLL_INTRO            1        /* Introduction packet */
+#define POLL_TOPOLOGY         2        /* Topology update */
+#define POLL_ASSIGN           3        /* ID assign */
+#define POLL_FOAD             4        /* F*** Off And Die */
+#define POLL_LMD             5 /* Let Me Die */
+#define POLL_DYB             6 /* Die You Ba***** */
 
 /* The way data fields are split up for POLL packets */
-#define POLL_HOST_SERIAL      2            /* Host who booted me */
-#define POLL_MY_SERIAL        6            /* My serial number */
-#define POLL_YOUR_ID          1            /* Your ID number */
-#define POLL_TOPOLOGY_FIELDS  2            /* Topology maps */
+#define POLL_HOST_SERIAL      2        /* Host who booted me */
+#define POLL_MY_SERIAL        6        /* My serial number */
+#define POLL_YOUR_ID          1        /* Your ID number */
+#define POLL_TOPOLOGY_FIELDS  2        /* Topology maps */
 
 #endif
 
 /*********** end of file ***********/
-
-
-
index 8506af06aa9f6939d98449b99253c06817ee57ff..c99b1e70fdc8bca7c212c319d089a116c22528e7 100644 (file)
@@ -46,96 +46,94 @@ static char *_port_h_sccs_ = "@(#)port.h    1.3";
 */
 
 #ifdef STATS
-struct RIOStats
-{
+struct RIOStats {
        /*
-       ** interrupt statistics
-       */
-       uint    BreakIntCnt;
-       uint    ModemOffCnt;
-       uint    ModemOnCnt;
-       uint    RxIntCnt;
-       uint    TxIntCnt;
+        ** interrupt statistics
+        */
+       uint BreakIntCnt;
+       uint ModemOffCnt;
+       uint ModemOnCnt;
+       uint RxIntCnt;
+       uint TxIntCnt;
        /*
-       ** throughput statistics
-       */
-       uint    RxCharCnt;
-       uint    RxPktCnt;
-       uint    RxSaveCnt;
-       uint    TxCharCnt;
-       uint    TxPktCnt;
+        ** throughput statistics
+        */
+       uint RxCharCnt;
+       uint RxPktCnt;
+       uint RxSaveCnt;
+       uint TxCharCnt;
+       uint TxPktCnt;
        /*
-       ** driver entry statistics
-       */
-       uint    CloseCnt;
-       uint    IoctlCnt;
-       uint    OpenCnt;
-       uint    ReadCnt;
-       uint    WriteCnt;
+        ** driver entry statistics
+        */
+       uint CloseCnt;
+       uint IoctlCnt;
+       uint OpenCnt;
+       uint ReadCnt;
+       uint WriteCnt;
        /*
-       ** proc statistics
-       */
-       uint    BlockCnt;
-       uint    OutputCnt;
-       uint    ResumeCnt;
-       uint    RflushCnt;
-       uint    SuspendCnt;
-       uint    TbreakCnt;
-       uint    TimeoutCnt;
-       uint    UnblockCnt;
-       uint    WflushCnt;
-       uint    WFBodgeCnt;
+        ** proc statistics
+        */
+       uint BlockCnt;
+       uint OutputCnt;
+       uint ResumeCnt;
+       uint RflushCnt;
+       uint SuspendCnt;
+       uint TbreakCnt;
+       uint TimeoutCnt;
+       uint UnblockCnt;
+       uint WflushCnt;
+       uint WFBodgeCnt;
 };
 #endif
 
 /*
 **     Port data structure
 */
-struct Port
-{
-  struct gs_port gs; 
-  int                          PortNum;        /* RIO port no., 0-511 */
-  struct Host  *HostP;
-  volatile caddr_t             Caddr;
-  ushort                       HostPort;  /* Port number on host card */
-  uchar                        RupNum; /* Number of RUP for port */
-  uchar                        ID2;    /* Second ID of RTA for port */
-  ulong                        State;  /* FLAGS for open & xopen */
-#define        RIO_LOPEN       0x00001         /* Local open */
-#define        RIO_MOPEN       0x00002         /* Modem open */
-#define        RIO_WOPEN       0x00004         /* Waiting for open */
-#define        RIO_CLOSING     0x00008         /* The port is being close */
-#define        RIO_XPBUSY      0x00010         /* Transparent printer busy */
-#define        RIO_BREAKING    0x00020         /* Break in progress */
-#define        RIO_DIRECT      0x00040         /* Doing Direct output */
-#define        RIO_EXCLUSIVE   0x00080         /* Stream open for exclusive use */
-#define        RIO_NDELAY      0x00100         /* Stream is open FNDELAY */
-#define        RIO_CARR_ON     0x00200         /* Stream has carrier present */
-#define        RIO_XPWANTR     0x00400         /* Stream wanted by Xprint */
-#define        RIO_RBLK        0x00800         /* Stream is read-blocked */
-#define        RIO_BUSY        0x01000         /* Stream is BUSY for write */
-#define        RIO_TIMEOUT     0x02000         /* Stream timeout in progress */
-#define        RIO_TXSTOP      0x04000         /* Stream output is stopped */
-#define        RIO_WAITFLUSH   0x08000         /* Stream waiting for flush */
-#define        RIO_DYNOROD     0x10000         /* Drain failed */
-#define        RIO_DELETED     0x20000         /* RTA has been deleted */
-#define RIO_ISSCANCODE 0x40000         /* This line is in scancode mode */
+struct Port {
+       struct gs_port gs;
+       int PortNum;            /* RIO port no., 0-511 */
+       struct Host *HostP;
+       volatile caddr_t Caddr;
+       ushort HostPort;        /* Port number on host card */
+       uchar RupNum;           /* Number of RUP for port */
+       uchar ID2;              /* Second ID of RTA for port */
+       ulong State;            /* FLAGS for open & xopen */
+#define        RIO_LOPEN       0x00001 /* Local open */
+#define        RIO_MOPEN       0x00002 /* Modem open */
+#define        RIO_WOPEN       0x00004 /* Waiting for open */
+#define        RIO_CLOSING     0x00008 /* The port is being close */
+#define        RIO_XPBUSY      0x00010 /* Transparent printer busy */
+#define        RIO_BREAKING    0x00020 /* Break in progress */
+#define        RIO_DIRECT      0x00040 /* Doing Direct output */
+#define        RIO_EXCLUSIVE   0x00080 /* Stream open for exclusive use */
+#define        RIO_NDELAY      0x00100 /* Stream is open FNDELAY */
+#define        RIO_CARR_ON     0x00200 /* Stream has carrier present */
+#define        RIO_XPWANTR     0x00400 /* Stream wanted by Xprint */
+#define        RIO_RBLK        0x00800 /* Stream is read-blocked */
+#define        RIO_BUSY        0x01000 /* Stream is BUSY for write */
+#define        RIO_TIMEOUT     0x02000 /* Stream timeout in progress */
+#define        RIO_TXSTOP      0x04000 /* Stream output is stopped */
+#define        RIO_WAITFLUSH   0x08000 /* Stream waiting for flush */
+#define        RIO_DYNOROD     0x10000 /* Drain failed */
+#define        RIO_DELETED     0x20000 /* RTA has been deleted */
+#define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */
 #define        RIO_USING_EUC   0x100000        /* Using extended Unix chars */
 #define        RIO_CAN_COOK    0x200000        /* This line can do cooking */
-#define RIO_TRIAD_MODE  0x400000        /* Enable TRIAD special ops. */
-#define RIO_TRIAD_BLOCK 0x800000        /* Next read will block */
-#define RIO_TRIAD_FUNC  0x1000000       /* Seen a function key coming in */
-#define RIO_THROTTLE_RX 0x2000000       /* RX needs to be throttled. */
+#define RIO_TRIAD_MODE  0x400000       /* Enable TRIAD special ops. */
+#define RIO_TRIAD_BLOCK 0x800000       /* Next read will block */
+#define RIO_TRIAD_FUNC  0x1000000      /* Seen a function key coming in */
+#define RIO_THROTTLE_RX 0x2000000      /* RX needs to be throttled. */
 
-    ulong                      Config; /* FLAGS for NOREAD.... */
-#define        RIO_NOREAD      0x0001          /* Are not allowed to read port */
-#define        RIO_NOWRITE     0x0002          /* Are not allowed to write port */
-#define        RIO_NOXPRINT    0x0004          /* Are not allowed to xprint port */
-#define        RIO_NOMASK      0x0007          /* All not allowed things */
-#define RIO_IXANY      0x0008          /* Port is allowed ixany */
-#define        RIO_MODEM       0x0010          /* Stream is a modem device */
-#define        RIO_IXON        0x0020          /* Port is allowed ixon */
-#define RIO_WAITDRAIN  0x0040          /* Wait for port to completely drain */
+       ulong Config;           /* FLAGS for NOREAD.... */
+#define        RIO_NOREAD      0x0001  /* Are not allowed to read port */
+#define        RIO_NOWRITE     0x0002  /* Are not allowed to write port */
+#define        RIO_NOXPRINT    0x0004  /* Are not allowed to xprint port */
+#define        RIO_NOMASK      0x0007  /* All not allowed things */
+#define RIO_IXANY      0x0008  /* Port is allowed ixany */
+#define        RIO_MODEM       0x0010  /* Stream is a modem device */
+#define        RIO_IXON        0x0020  /* Port is allowed ixon */
+#define RIO_WAITDRAIN  0x0040  /* Wait for port to completely drain */
 #define RIO_MAP_50_TO_50       0x0080  /* Map 50 baud to 50 baud */
 #define RIO_MAP_110_TO_110     0x0100  /* Map 110 baud to 110 baud */
 
@@ -144,92 +142,90 @@ struct    Port
 ** As LynxOS does not appear to support Hardware Flow Control .....
 ** Define our own flow control flags in 'Config'.
 */
-#define RIO_CTSFLOW    0x0200          /* RIO's own CTSFLOW flag */
-#define RIO_RTSFLOW    0x0400          /* RIO's own RTSFLOW flag */
+#define RIO_CTSFLOW    0x0200  /* RIO's own CTSFLOW flag */
+#define RIO_RTSFLOW    0x0400  /* RIO's own RTSFLOW flag */
 
 
-    struct PHB                 *PhbP;    /* pointer to PHB for port */
-    WORD                        *TxAdd;   /* Add packets here */
-    WORD                        *TxStart; /* Start of add array */
-    WORD                        *TxEnd;         /* End of add array */
-    WORD                        *RxRemove;      /* Remove packets here */
-    WORD                        *RxStart;       /* Start of remove array */
-    WORD                        *RxEnd;         /* End of remove array */
-    uint                       RtaUniqueNum;   /* Unique number of RTA */
-    ushort                     PortState;      /* status of port */
-    ushort                     ModemState;     /* status of modem lines */
-    ulong                      ModemLines;     /* Modem bits sent to RTA */
-    uchar                      CookMode;       /* who expands CR/LF? */
-    uchar                      ParamSem;       /* Prevent write during param */
-    uchar                      Mapped;         /* if port mapped onto host */
-    uchar                      SecondBlock;    /* if port belongs to 2nd block
-                                                  of 16 port RTA */
-    uchar                      InUse;          /* how many pre-emptive cmds */
-    uchar                      Lock;           /* if params locked */
-    uchar                      Store;  /* if params stored across closes */
-    uchar                      FirstOpen; /* TRUE if first time port opened */
-    uchar                      FlushCmdBodge;  /* if doing a (non)flush */
-    uchar                      MagicFlags;     /* require intr processing */
+       struct PHB *PhbP;       /* pointer to PHB for port */
+       WORD *TxAdd;            /* Add packets here */
+       WORD *TxStart;          /* Start of add array */
+       WORD *TxEnd;            /* End of add array */
+       WORD *RxRemove;         /* Remove packets here */
+       WORD *RxStart;          /* Start of remove array */
+       WORD *RxEnd;            /* End of remove array */
+       uint RtaUniqueNum;      /* Unique number of RTA */
+       ushort PortState;       /* status of port */
+       ushort ModemState;      /* status of modem lines */
+       ulong ModemLines;       /* Modem bits sent to RTA */
+       uchar CookMode;         /* who expands CR/LF? */
+       uchar ParamSem;         /* Prevent write during param */
+       uchar Mapped;           /* if port mapped onto host */
+       uchar SecondBlock;      /* if port belongs to 2nd block
+                                  of 16 port RTA */
+       uchar InUse;            /* how many pre-emptive cmds */
+       uchar Lock;             /* if params locked */
+       uchar Store;            /* if params stored across closes */
+       uchar FirstOpen;        /* TRUE if first time port opened */
+       uchar FlushCmdBodge;    /* if doing a (non)flush */
+       uchar MagicFlags;       /* require intr processing */
 #define        MAGIC_FLUSH     0x01    /* mirror of WflushFlag */
 #define        MAGIC_REBOOT    0x02    /* RTA re-booted, re-open ports */
 #define        MORE_OUTPUT_EYGOR 0x04  /* riotproc failed to empty clists */
-    uchar                      WflushFlag;     /* 1 How many WFLUSHs active */
+       uchar WflushFlag;       /* 1 How many WFLUSHs active */
 /*
 ** Transparent print stuff
 */
-    struct Xprint
-    {
+       struct Xprint {
 #ifndef MAX_XP_CTRL_LEN
-#define MAX_XP_CTRL_LEN                16              /* ALSO IN DAEMON.H */
+#define MAX_XP_CTRL_LEN                16      /* ALSO IN DAEMON.H */
 #endif
-       uint                    XpCps;
-       char                    XpOn[MAX_XP_CTRL_LEN];
-       char                    XpOff[MAX_XP_CTRL_LEN];
-       ushort                  XpLen;          /* strlen(XpOn)+strlen(XpOff) */
-       uchar                   XpActive;
-       uchar                   XpLastTickOk;   /* TRUE if we can process */
+               uint XpCps;
+               char XpOn[MAX_XP_CTRL_LEN];
+               char XpOff[MAX_XP_CTRL_LEN];
+               ushort XpLen;   /* strlen(XpOn)+strlen(XpOff) */
+               uchar XpActive;
+               uchar XpLastTickOk;     /* TRUE if we can process */
 #define        XP_OPEN         00001
 #define        XP_RUNABLE      00002
-       struct ttystatics               *XttyP;
-    } Xprint;
+               struct ttystatics *XttyP;
+       } Xprint;
 #ifdef VPIX
-    v86_t                      *StashP;
-    uint                       IntMask;
-    struct termss              VpixSs;
-    uchar                      ModemStatusReg; /* Modem status register */
+       v86_t *StashP;
+       uint IntMask;
+       struct termss VpixSs;
+       uchar ModemStatusReg;   /* Modem status register */
 #endif
-    uchar                      RxDataStart;
-    uchar                      Cor2Copy;       /* copy of COR2 */
-    char                       *Name;          /* points to the Rta's name */
+       uchar RxDataStart;
+       uchar Cor2Copy;         /* copy of COR2 */
+       char *Name;             /* points to the Rta's name */
 #ifdef STATS
-    struct RIOStats            Stat;           /* ports statistics */
+       struct RIOStats Stat;   /* ports statistics */
 #endif
-    char                       *TxRingBuffer;
-    ushort                     TxBufferIn;     /* New data arrives here */
-    ushort                     TxBufferOut;    /* Intr removes data here */
-    ushort                     OldTxBufferOut; /* Indicates if draining */
-    int                                TimeoutId;      /* Timeout ID */
-    uint                       Debug;
-    uchar                      WaitUntilBooted; /* True if open should block */
-    uint                       statsGather;    /* True if gathering stats */
-    ulong                      txchars;        /* Chars transmitted */
-    ulong                      rxchars;        /* Chars received */
-    ulong                      opens;          /* port open count */
-    ulong                      closes;         /* port close count */
-    ulong                      ioctls;         /* ioctl count */
-    uchar                      LastRxTgl;      /* Last state of rx toggle bit */
-  spinlock_t                           portSem;        /* Lock using this sem */
-       int                             MonitorTstate;  /* Monitoring ? */
-       int                             timeout_id;     /* For calling 100 ms delays */
-       int                             timeout_sem;/* For calling 100 ms delays */
-       int                             firstOpen;      /* First time open ? */
-       char *                  p;                      /* save the global struc here .. */
+       char *TxRingBuffer;
+       ushort TxBufferIn;      /* New data arrives here */
+       ushort TxBufferOut;     /* Intr removes data here */
+       ushort OldTxBufferOut;  /* Indicates if draining */
+       int TimeoutId;          /* Timeout ID */
+       uint Debug;
+       uchar WaitUntilBooted;  /* True if open should block */
+       uint statsGather;       /* True if gathering stats */
+       ulong txchars;          /* Chars transmitted */
+       ulong rxchars;          /* Chars received */
+       ulong opens;            /* port open count */
+       ulong closes;           /* port close count */
+       ulong ioctls;           /* ioctl count */
+       uchar LastRxTgl;        /* Last state of rx toggle bit */
+       spinlock_t portSem;     /* Lock using this sem */
+       int MonitorTstate;      /* Monitoring ? */
+       int timeout_id;         /* For calling 100 ms delays */
+       int timeout_sem;        /* For calling 100 ms delays */
+       int firstOpen;          /* First time open ? */
+       char *p;                /* save the global struc here .. */
 };
 
-struct ModuleInfo
-{
-       char    *Name;
-       uint    Flags[4];       /* one per port on a module */
+struct ModuleInfo {
+       char *Name;
+       uint Flags[4];          /* one per port on a module */
 };
 #endif
 
@@ -238,8 +234,8 @@ struct ModuleInfo
 ** runs into problems with differing struct sizes between driver and config.
 */
 struct PortParams {
-       uint    Port;
-       ulong   Config;
-       ulong   State;
-       struct ttystatics       *TtyP;
+       uint Port;
+       ulong Config;
+       ulong State;
+       struct ttystatics *TtyP;
 };
index ddff0ef84e3a42d24a21b56f7674e48402dcccfb..f9a3376333e560e7b1f7c95367faf3dc556178a0 100644 (file)
 /*
 ** boot.c
 */
-void init_boot( char *p, short stage);
+void init_boot(char *p, short stage);
 
 /*
 ** disconct.c
 */
-void kill_boot ( LPB *link );
-void disconnected( LPB *link );
-short boot_3( LPB *link, PKT *pkt );
-short send_3_pkt( LPB *link, PKT *pkt);
+void kill_boot(LPB * link);
+void disconnected(LPB * link);
+short boot_3(LPB * link, PKT * pkt);
+short send_3_pkt(LPB * link, PKT * pkt);
 
 /*
 ** error.c
@@ -41,116 +41,116 @@ void du_error(void);
 /*
 ** formpkt.c
 */
-ushort sum_it( PKT *pkt ) ;
-void form_rup_pkt( RUP *form_rup, PKT *pkt );
-void form_poll_pkt ( int type, LPB *link, int node );
-void form_route_pkt ( int type, PKT *pkt, LPB *link );
+ushort sum_it(PKT * pkt);
+void form_rup_pkt(RUP * form_rup, PKT * pkt);
+void form_poll_pkt(int type, LPB * link, int node);
+void form_route_pkt(int type, PKT * pkt, LPB * link);
 
 /*
 ** idle.c
 */
-void idle( Process *idle_p );
+void idle(Process * idle_p);
 
 /*
 ** init.c
 */
 void general_init(void);
-void mem_halt( int error);
+void mem_halt(int error);
 
 /*
 ** linkinit.c
 */
-void initlink( u_short number, LPB *link);
-void runlink( LPB *link);
+void initlink(u_short number, LPB * link);
+void runlink(LPB * link);
 
 /*
 ** list.c
 */
 PKT *get_free_start(void);
-void put_free_start( PKT *pkt);
+void put_free_start(PKT * pkt);
 
 #ifdef HOST
-int can_remove_transmit ( PKT **pkt, PKT *pointer );
+int can_remove_transmit(PKT ** pkt, PKT * pointer);
 #endif
 
 #ifdef RTA
-int spl7 ( void );
-int spl0 ( void );
-Q_BUF *get_free_q( void );
+int spl7(void);
+int spl0(void);
+Q_BUF *get_free_q(void);
 PKT *get_free_end(void);
-int add_end( PKT *pkt, PHB *phb, int type);
-unsigned short free_packets( PHB *phb, int type);
-int can_remove_start( PKT **pkt, PHB *phb, int type);
-int can_add_start( PHB *phb, int type);
-int can_add_end( PHB *phb, int type);
-void put_free_end( PKT *pkt);
-int remove_start( PKT **pkt, PHB *phb, int type);
+int add_end(PKT * pkt, PHB * phb, int type);
+unsigned short free_packets(PHB * phb, int type);
+int can_remove_start(PKT ** pkt, PHB * phb, int type);
+int can_add_start(PHB * phb, int type);
+int can_add_end(PHB * phb, int type);
+void put_free_end(PKT * pkt);
+int remove_start(PKT ** pkt, PHB * phb, int type);
 #endif
 
 /*
 ** Lrt.c
 */
-void lrt( Process *lrt_p, LPB *link );
+void lrt(Process * lrt_p, LPB * link);
 
 #ifdef RTA
-void set_led_red ( LPB *link );
+void set_led_red(LPB * link);
 #endif
 
 /*
 ** ltt.c
 */
-void ltt( Process *ltt_p, LPB *link, PHB *phb_ptr[] );
-void send_poll ( LPB *link );
-void request_id ( LPB *link );
-void send_topology_update ( LPB *link );
-void send_topology ( LPB *link );
-void supply_id ( LPB *link );
+void ltt(Process * ltt_p, LPB * link, PHB * phb_ptr[]);
+void send_poll(LPB * link);
+void request_id(LPB * link);
+void send_topology_update(LPB * link);
+void send_topology(LPB * link);
+void supply_id(LPB * link);
 
 #ifdef RTA
-void redirect_queue ( LPB *link, ushort flush );
-int obtain_rup ( int rup_number, PKT **pkt_address, LPB *link );
+void redirect_queue(LPB * link, ushort flush);
+int obtain_rup(int rup_number, PKT ** pkt_address, LPB * link);
 #endif
 
 #ifdef TESTING_PERF
-int consume_cpu( void );
+int consume_cpu(void);
 #endif
 
 /*
 ** lttwake.c
 */
 #ifdef HOST
-void ltt_wakeup( Process *ltt_wakeup_p );
+void ltt_wakeup(Process * ltt_wakeup_p);
 #endif
 
 /*
 ** mapgen.c
 */
-void generate_id_map( short mapping, ROUTE_STR route[] );
-void gen_map( int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl );
-void adjust_ttl( int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl);
+void generate_id_map(short mapping, ROUTE_STR route[]);
+void gen_map(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl);
+void adjust_ttl(int mapping, int looking_at, int come_from, ROUTE_STR route[], int link, int *ttl);
 void init_sys_map(void);
 
 /*
 ** mmu.c
 */
-char *rio_malloc( unsigned int amount);
-char *rio_calloc( unsigned int num, unsigned int size);
-ERROR rio_mmu_init( uint total_mem );
+char *rio_malloc(unsigned int amount);
+char *rio_calloc(unsigned int num, unsigned int size);
+ERROR rio_mmu_init(uint total_mem);
 
 /*
 ** partn.c
 */
-void partition_tx( struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit);
+void partition_tx(struct PHB *phb, u_short tx_size, u_short rx_size, u_short rx_limit);
 
 /*
 ** poll.c
 */
-void tx_poll( Process *tx_poll_p);
+void tx_poll(Process * tx_poll_p);
 
 /*
 ** process.c
 */
-int  get_proc_space( Process **pd, int **pws, int wssize);
+int get_proc_space(Process ** pd, int **pws, int wssize);
 
 /*
 ** readrom.c
@@ -160,85 +160,85 @@ void read_serial_number(char *buf);
 /*
 ** rio.c
 */
-int main( void );
+int main(void);
 
 /*
 ** route.c
 */
-void route_update ( PKT *pkt, LPB *link);
+void route_update(PKT * pkt, LPB * link);
 
 /*
 ** rtainit.c
 */
 #if defined(RTA)
 void rta_init(ushort RtaType);
-#endif /* defined(RTA) */
+#endif                         /* defined(RTA) */
 
 /*
 ** rupboot.c
 */
-void rup_boot( PKT *pkt, RUP *this_rup, LPB *link);
+void rup_boot(PKT * pkt, RUP * this_rup, LPB * link);
 
 #ifdef RTA
-void kill_your_neighbour( int link_to_kill );
+void kill_your_neighbour(int link_to_kill);
 #endif
 
 /*
 ** rupcmd.c
 */
-void rup_command( PKT *pkt, struct RUP *this_rup, LPB *link);
+void rup_command(PKT * pkt, struct RUP *this_rup, LPB * link);
 
 /*
 ** ruperr.c
 */
-void rup_error( PKT *pkt, RUP *this_rup, LPB *link );
-void illegal_cmd( PKT *src_pkt );
+void rup_error(PKT * pkt, RUP * this_rup, LPB * link);
+void illegal_cmd(PKT * src_pkt);
 
 /*
 ** ruppoll.c
 */
-void rup_poll( PKT *pkt, RUP *this_rup, LPB *link );
+void rup_poll(PKT * pkt, RUP * this_rup, LPB * link);
 
 /*
 ** ruppower.c
 */
-void rup_power( PKT *pkt, RUP *this_rup, LPB *link );
+void rup_power(PKT * pkt, RUP * this_rup, LPB * link);
 
 /*
 ** ruprm.c
 */
-void rup_route_map( PKT *pkt, RUP *this_rup, LPB *link);
+void rup_route_map(PKT * pkt, RUP * this_rup, LPB * link);
 
 /*
 ** rupstat.c
 */
-void rup_status( PKT *pkt, RUP *this_rup, LPB *link);
+void rup_status(PKT * pkt, RUP * this_rup, LPB * link);
 
 /*
 ** rupsync.c
 */
-void rup_sync( PKT *pkt);
+void rup_sync(PKT * pkt);
 
 /*
 ** rxpkt.c
 */
-ERROR  rx_pkt( PKT_ptr_ptr pkt_address, LPB *link);
+ERROR rx_pkt(PKT_ptr_ptr pkt_address, LPB * link);
 
 /*
 ** sendsts.c
 */
-void send_status( PKT *requesting_pkt, RUP *this_rup);
+void send_status(PKT * requesting_pkt, RUP * this_rup);
 
 /*
 ** serial.c
 */
-void assign_serial ( char *ser_in, char *ser_out);
-int cmp_serial ( char *ser_1, char *ser_2);
+void assign_serial(char *ser_in, char *ser_out);
+int cmp_serial(char *ser_1, char *ser_2);
 
 /*
 ** txpkt.c
 */
-ERROR  tx_pkt( PKT *pkt, LPB *link);
-short send_sync( LPB *link);
+ERROR tx_pkt(PKT * pkt, LPB * link);
+short send_sync(LPB * link);
 
-#endif /* _prototypes_h */
+#endif                         /* _prototypes_h */
index 848111ac93800dba03d9141bd8e1089cb0f019ce..69fc4bc34153602f2738af08582ac1c189b0d3af 100644 (file)
 #endif
 
 /*********** end of file ***********/
-
-
index 1fce02f8fcfcf1af8beda510a760f8e0057ed055..acd9e8e5307de628a2282aeaf4603aa90a48bda3 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_qbuf_h_sccs = "@(#)qbuf.h    1.1" ;
+static char *_rio_qbuf_h_sccs = "@(#)qbuf.h    1.1";
 #endif
 #endif
 
@@ -52,16 +52,15 @@ static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1" ;
 #define PKTS_PER_BUFFER    (220 / PKT_LENGTH)
 #endif
 
-typedef struct Q_BUF Q_BUF ;
-struct Q_BUF  {
-                  Q_BUF_ptr next ;
-                  Q_BUF_ptr prev ;
-                  PKT_ptr buf[PKTS_PER_BUFFER] ;
-              } ;
+typedef struct Q_BUF Q_BUF;
+struct Q_BUF {
+       Q_BUF_ptr next;
+       Q_BUF_ptr prev;
+       PKT_ptr buf[PKTS_PER_BUFFER];
+};
 
 
 #endif
 
 
 /*********** end of file ***********/
-
index 13a9931958b1f3b346841e15059bb702b6bd0ab3..7f45e1ab53325fd5d49726fd9cef44dd7a833a0d 100644 (file)
@@ -72,8 +72,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h        1.3";
 #define        RIO_HOSTS       4       /* number of hosts that can be found */
 #define        PORTS_PER_HOST  128     /* number of ports per host */
 #define        LINKS_PER_UNIT  4       /* number of links from a host */
-#define        RIO_PORTS       (PORTS_PER_HOST * RIO_HOSTS) /* max. no. of ports */
-#define        RTAS_PER_HOST   (MAX_RUP) /* number of RTAs per host */
+#define        RIO_PORTS       (PORTS_PER_HOST * RIO_HOSTS)    /* max. no. of ports */
+#define        RTAS_PER_HOST   (MAX_RUP)       /* number of RTAs per host */
 #define        PORTS_PER_RTA   (PORTS_PER_HOST/RTAS_PER_HOST)  /* ports on a rta */
 #define        PORTS_PER_MODULE 4      /* number of ports on a plug-in module */
                                /* number of modules on an RTA */
@@ -216,10 +216,9 @@ static char *_rio_h_sccs_ = "@(#)rio.h     1.3";
 #define        RIO_PRI (PZERO+10)
 #define RIO_CLOSE_PRI  PZERO-1 /* uninterruptible sleeps for close */
 
-typedef struct DbInf
-{
-       uint    Flag;
-       char    Name[8];
+typedef struct DbInf {
+       uint Flag;
+       char Name[8];
 } DbInf;
 
 #ifndef TRUE
@@ -251,7 +250,7 @@ typedef struct DbInf
        *((uint *)PK)    = PP->PacketInfo; \
 }
 
-#define        RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to        */
+#define        RIO_LINK_ENABLE 0x80FF  /* FF is a hack, mainly for Mips, to        */
                               /* prevent a really stupid race condition.  */
 
 #define        NOT_INITIALISED 0
@@ -291,4 +290,4 @@ typedef struct DbInf
 #define DIST_LINESW_OUTPUT     0x40
 #define DIST_LINESW_MDMINT     0x80
 
-#endif /* __rio_h__ */
+#endif                         /* __rio_h__ */
index 7085a38532b3ccc9cc1a73fe5f68eb2e3f064c70..8825bd61b7d09e881daf5a887e74480c212b4850 100644 (file)
@@ -33,7 +33,7 @@
  * */
 
 #include <linux/module.h>
-#include <linux/config.h> 
+#include <linux/config.h>
 #include <linux/kdev_t.h>
 #include <asm/io.h>
 #include <linux/kernel.h>
@@ -112,7 +112,7 @@ more than 512 ports.... */
 #define PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8 0x2000
 #endif
 
-#ifndef RIO_WINDOW_LEN 
+#ifndef RIO_WINDOW_LEN
 #define RIO_WINDOW_LEN 0x10000
 #endif
 
@@ -140,34 +140,51 @@ more than 512 ports.... */
  */
 #define RIO_REPORT_FIFO
 #define RIO_REPORT_OVERRUN
-#endif 
+#endif
 
 
 /* These constants are derived from SCO Source */
 static struct Conf
-RIOConf =
-{
-  /* locator */         "RIO Config here",
-  /* startuptime */     HZ*2,           /* how long to wait for card to run */
-  /* slowcook */        0,              /* TRUE -> always use line disc. */
-  /* intrpolltime */    1,              /* The frequency of OUR polls */
-  /* breakinterval */   25,             /* x10 mS XXX: units seem to be 1ms not 10! -- REW*/
-  /* timer */           10,             /* mS */
-  /* RtaLoadBase */     0x7000,
-  /* HostLoadBase */    0x7C00,
-  /* XpHz */            5,              /* number of Xprint hits per second */
-  /* XpCps */           120,            /* Xprint characters per second */
-  /* XpOn */            "\033d#",       /* start Xprint for a wyse 60 */
-  /* XpOff */           "\024",         /* end Xprint for a wyse 60 */
-  /* MaxXpCps */        2000,           /* highest Xprint speed */
-  /* MinXpCps */        10,             /* slowest Xprint speed */
-  /* SpinCmds */        1,              /* non-zero for mega fast boots */
-  /* First Addr */      0x0A0000,       /* First address to look at */
-  /* Last Addr */       0xFF0000,       /* Last address looked at */
-  /* BufferSize */      1024,           /* Bytes per port of buffering */
-  /* LowWater */        256,            /* how much data left before wakeup */
-  /* LineLength */      80,             /* how wide is the console? */
-  /* CmdTimeout */      HZ,             /* how long a close command may take */
+ RIOConf = {
+       /* locator */ "RIO Config here",
+                                       /* startuptime */ HZ * 2,
+                                       /* how long to wait for card to run */
+                               /* slowcook */ 0,
+                               /* TRUE -> always use line disc. */
+                               /* intrpolltime */ 1,
+                               /* The frequency of OUR polls */
+                               /* breakinterval */ 25,
+                               /* x10 mS XXX: units seem to be 1ms not 10! -- REW */
+                               /* timer */ 10,
+                               /* mS */
+       /* RtaLoadBase */ 0x7000,
+       /* HostLoadBase */ 0x7C00,
+                               /* XpHz */ 5,
+                               /* number of Xprint hits per second */
+                               /* XpCps */ 120,
+                               /* Xprint characters per second */
+                               /* XpOn */ "\033d#",
+                               /* start Xprint for a wyse 60 */
+                               /* XpOff */ "\024",
+                               /* end Xprint for a wyse 60 */
+                               /* MaxXpCps */ 2000,
+                               /* highest Xprint speed */
+                               /* MinXpCps */ 10,
+                               /* slowest Xprint speed */
+                               /* SpinCmds */ 1,
+                               /* non-zero for mega fast boots */
+                                       /* First Addr */ 0x0A0000,
+                                       /* First address to look at */
+                                       /* Last Addr */ 0xFF0000,
+                                       /* Last address looked at */
+                               /* BufferSize */ 1024,
+                               /* Bytes per port of buffering */
+                               /* LowWater */ 256,
+                               /* how much data left before wakeup */
+                               /* LineLength */ 80,
+                               /* how wide is the console? */
+                               /* CmdTimeout */ HZ,
+                               /* how long a close command may take */
 };
 
 
@@ -175,21 +192,20 @@ RIOConf =
 
 /* Function prototypes */
 
-static void rio_disable_tx_interrupts (void * ptr); 
-static void rio_enable_tx_interrupts (void * ptr); 
-static void rio_disable_rx_interrupts (void * ptr); 
-static void rio_enable_rx_interrupts (void * ptr); 
-static int  rio_get_CD (void * ptr); 
-static void rio_shutdown_port (void * ptr);
-static int  rio_set_real_termios (void  *ptr);
-static void rio_hungup (void  *ptr);
-static void rio_close (void  *ptr);
-static int rio_chars_in_buffer (void * ptr);
-static int rio_fw_ioctl (struct inode *inode, struct file *filp,
-                        unsigned int cmd, unsigned long arg);
+static void rio_disable_tx_interrupts(void *ptr);
+static void rio_enable_tx_interrupts(void *ptr);
+static void rio_disable_rx_interrupts(void *ptr);
+static void rio_enable_rx_interrupts(void *ptr);
+static int rio_get_CD(void *ptr);
+static void rio_shutdown_port(void *ptr);
+static int rio_set_real_termios(void *ptr);
+static void rio_hungup(void *ptr);
+static void rio_close(void *ptr);
+static int rio_chars_in_buffer(void *ptr);
+static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
 static int rio_init_drivers(void);
 
-static void my_hd (void *addr, int len);
+static void my_hd(void *addr, int len);
 
 static struct tty_driver *rio_driver, *rio_driver2;
 
@@ -209,7 +225,7 @@ static int rio_poll = 1;
 
 /* These are the only open spaces in my computer. Yours may have more
    or less.... */
-static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000};
+static int rio_probe_addrs[] = { 0xc0000, 0xd0000, 0xe0000 };
 
 #define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs)
 
@@ -227,17 +243,17 @@ module_param(rio_debug, int, 0644);
 module_param(rio_irqmask, long, 0);
 
 static struct real_driver rio_real_driver = {
-  rio_disable_tx_interrupts,
-  rio_enable_tx_interrupts,
-  rio_disable_rx_interrupts,
-  rio_enable_rx_interrupts,
-  rio_get_CD,
-  rio_shutdown_port, 
-  rio_set_real_termios, 
-  rio_chars_in_buffer,
-  rio_close,
-  rio_hungup,
-  NULL
+       rio_disable_tx_interrupts,
+       rio_enable_tx_interrupts,
+       rio_disable_rx_interrupts,
+       rio_enable_rx_interrupts,
+       rio_get_CD,
+       rio_shutdown_port,
+       rio_set_real_termios,
+       rio_chars_in_buffer,
+       rio_close,
+       rio_hungup,
+       NULL
 };
 
 /* 
@@ -246,8 +262,8 @@ static struct real_driver rio_real_driver = {
  */
 
 static struct file_operations rio_fw_fops = {
-       .owner          = THIS_MODULE,
-       .ioctl          = rio_fw_ioctl,
+       .owner = THIS_MODULE,
+       .ioctl = rio_fw_ioctl,
 };
 
 static struct miscdevice rio_fw_device = {
@@ -262,25 +278,22 @@ static struct miscdevice rio_fw_device = {
 
 /* This doesn't work. Who's paranoid around here? Not me! */
 
-static inline int rio_paranoia_check(struct rio_port const * port,
-                                   char *name, const char *routine)
+static inline int rio_paranoia_check(struct rio_port const *port, char *name, const char *routine)
 {
 
-  static const char *badmagic =
-    KERN_ERR "rio: Warning: bad rio port magic number for device %s in %s\n";
-  static const char *badinfo =
-    KERN_ERR "rio: Warning: null rio port for device %s in %s\n";
-  if (!port) {
-    printk (badinfo, name, routine);
-    return 1;
-  }
-  if (port->magic != RIO_MAGIC) {
-    printk (badmagic, name, routine);
-    return 1;
-  }
-
-  return 0;
+       static const char *badmagic = KERN_ERR "rio: Warning: bad rio port magic number for device %s in %s\n";
+       static const char *badinfo = KERN_ERR "rio: Warning: null rio port for device %s in %s\n";
+
+       if (!port) {
+               printk(badinfo, name, routine);
+               return 1;
+       }
+       if (port->magic != RIO_MAGIC) {
+               printk(badmagic, name, routine);
+               return 1;
+       }
+
+       return 0;
 }
 #else
 #define rio_paranoia_check(a,b,c) 0
@@ -288,53 +301,53 @@ static inline int rio_paranoia_check(struct rio_port const * port,
 
 
 #ifdef DEBUG
-static void my_hd (void *ad, int len)
+static void my_hd(void *ad, int len)
 {
-  int i, j, ch;
-  unsigned char *addr = ad;
-  
-  for (i=0;i<len;i+=16) {
-    rio_dprintk (RIO_DEBUG_PARAM, "%08x ", (int) addr+i);
-    for (j=0;j<16;j++) {
-      rio_dprintk (RIO_DEBUG_PARAM, "%02x %s", addr[j+i], (j==7)?" ":"");
-    }
-    for (j=0;j<16;j++) {
-      ch = addr[j+i];
-      rio_dprintk (RIO_DEBUG_PARAM, "%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch));
-    }
-    rio_dprintk (RIO_DEBUG_PARAM, "\n");
-  }
+       int i, j, ch;
+       unsigned char *addr = ad;
+
+       for (i = 0; i < len; i += 16) {
+               rio_dprintk(RIO_DEBUG_PARAM, "%08x ", (int) addr + i);
+               for (j = 0; j < 16; j++) {
+                       rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : "");
+               }
+               for (j = 0; j < 16; j++) {
+                       ch = addr[j + i];
+                       rio_dprintk(RIO_DEBUG_PARAM, "%c", (ch < 0x20) ? '.' : ((ch > 0x7f) ? '.' : ch));
+               }
+               rio_dprintk(RIO_DEBUG_PARAM, "\n");
+       }
 }
 #else
 #define my_hd(ad,len) do{/* nothing*/ } while (0)
 #endif
 
 
-/* Delay a number of jiffies, allowing a signal to interrupt */ 
-int RIODelay (struct Port *PortP, int njiffies)
+/* Delay a number of jiffies, allowing a signal to interrupt */
+int RIODelay(struct Port *PortP, int njiffies)
 {
-  func_enter ();
+       func_enter();
 
-  rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies);  
-  msleep_interruptible(jiffies_to_msecs(njiffies));
-  func_exit();
+       rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies\n", njiffies);
+       msleep_interruptible(jiffies_to_msecs(njiffies));
+       func_exit();
 
-  if (signal_pending(current))
-    return RIO_FAIL;
-  else
-    return !RIO_FAIL;
+       if (signal_pending(current))
+               return RIO_FAIL;
+       else
+               return !RIO_FAIL;
 }
 
 
-/* Delay a number of jiffies, disallowing a signal to interrupt */ 
-int RIODelay_ni (struct Port *PortP, int njiffies)
+/* Delay a number of jiffies, disallowing a signal to interrupt */
+int RIODelay_ni(struct Port *PortP, int njiffies)
 {
-  func_enter ();
+       func_enter();
 
-  rio_dprintk (RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies);  
-  msleep(jiffies_to_msecs(njiffies));
-  func_exit();
-  return !RIO_FAIL;
+       rio_dprintk(RIO_DEBUG_DELAY, "delaying %d jiffies (ni)\n", njiffies);
+       msleep(jiffies_to_msecs(njiffies));
+       func_exit();
+       return !RIO_FAIL;
 }
 
 
@@ -350,126 +363,121 @@ int rio_ismodem(struct tty_struct *tty)
 }
 
 
-static int rio_set_real_termios (void *ptr)
+static int rio_set_real_termios(void *ptr)
 {
-  int rv, modem;
-  struct tty_struct *tty;
-  func_enter();
+       int rv, modem;
+       struct tty_struct *tty;
+       func_enter();
 
-  tty = ((struct Port *)ptr)->gs.tty;
+       tty = ((struct Port *) ptr)->gs.tty;
 
-  modem = rio_ismodem(tty);
+       modem = rio_ismodem(tty);
 
-  rv = RIOParam( (struct Port *) ptr, CONFIG, modem, 1);
+       rv = RIOParam((struct Port *) ptr, CONFIG, modem, 1);
 
-  func_exit ();
+       func_exit();
 
-  return rv;
+       return rv;
 }
 
 
-static void rio_reset_interrupt (struct Host *HostP)
+static void rio_reset_interrupt(struct Host *HostP)
 {
-  func_enter();
+       func_enter();
 
-  switch( HostP->Type ) {
-  case RIO_AT:
-  case RIO_MCA:
-  case RIO_PCI:
-    WBYTE(HostP->ResetInt , 0xff);
-  }
+       switch (HostP->Type) {
+       case RIO_AT:
+       case RIO_MCA:
+       case RIO_PCI:
+               WBYTE(HostP->ResetInt, 0xff);
+       }
 
-  func_exit();
+       func_exit();
 }
 
 
-static irqreturn_t rio_interrupt (int irq, void *ptr, struct pt_regs *regs)
+static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs)
 {
-  struct Host *HostP;
-  func_enter ();
+       struct Host *HostP;
+       func_enter();
 
-  HostP = (struct Host*)ptr; /* &p->RIOHosts[(long)ptr]; */
-  rio_dprintk (RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", 
-               irq, HostP->Ivec); 
+       HostP = (struct Host *) ptr;    /* &p->RIOHosts[(long)ptr]; */
+       rio_dprintk(RIO_DEBUG_IFLOW, "rio: enter rio_interrupt (%d/%d)\n", irq, HostP->Ivec);
 
-  /* AAargh! The order in which to do these things is essential and
-     not trivial. 
-     
-     - Rate limit goes before "recursive". Otherwise a series of
-       recursive calls will hang the machine in the interrupt routine. 
+       /* AAargh! The order in which to do these things is essential and
+          not trivial.
 
-     - hardware twiddling goes before "recursive". Otherwise when we
-       poll the card, and a recursive interrupt happens, we won't
-       ack the card, so it might keep on interrupting us. (especially
-       level sensitive interrupt systems like PCI).
+          - Rate limit goes before "recursive". Otherwise a series of
+          recursive calls will hang the machine in the interrupt routine.
 
-     - Rate limit goes before hardware twiddling. Otherwise we won't
-       catch a card that has gone bonkers.
+          - hardware twiddling goes before "recursive". Otherwise when we
+          poll the card, and a recursive interrupt happens, we won't
+          ack the card, so it might keep on interrupting us. (especially
+          level sensitive interrupt systems like PCI).
 
-     - The "initialized" test goes after the hardware twiddling. Otherwise
-       the card will stick us in the interrupt routine again.
+          - Rate limit goes before hardware twiddling. Otherwise we won't
+          catch a card that has gone bonkers.
 
-     - The initialized test goes before recursive. 
-  */
+          - The "initialized" test goes after the hardware twiddling. Otherwise
+          the card will stick us in the interrupt routine again.
+
+          - The initialized test goes before recursive.
+        */
 
 
 
 #ifdef IRQ_RATE_LIMIT
-  /* Aaargh! I'm ashamed. This costs more lines-of-code than the
-     actual interrupt routine!. (Well, used to when I wrote that comment) */
-  {
-    static int lastjif;
-    static int nintr=0;
-
-    if (lastjif == jiffies) {
-      if (++nintr > IRQ_RATE_LIMIT) {
-        free_irq (HostP->Ivec, ptr);
-        printk (KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", 
-                HostP->Ivec);
-      }
-    } else {
-      lastjif = jiffies;
-      nintr = 0;
-    }
-  }
+       /* Aaargh! I'm ashamed. This costs more lines-of-code than the
+          actual interrupt routine!. (Well, used to when I wrote that comment) */
+       {
+               static int lastjif;
+               static int nintr = 0;
+
+               if (lastjif == jiffies) {
+                       if (++nintr > IRQ_RATE_LIMIT) {
+                               free_irq(HostP->Ivec, ptr);
+                               printk(KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", HostP->Ivec);
+                       }
+               } else {
+                       lastjif = jiffies;
+                       nintr = 0;
+               }
+       }
 #endif
-  rio_dprintk (RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); 
-  if (HostP->Ivec == irq) {
-    /* Tell the card we've noticed the interrupt. */
-    rio_reset_interrupt (HostP);
-  }
-
-  if ((HostP->Flags & RUN_STATE) != RC_RUNNING)
-       return IRQ_HANDLED;
-
-  if (test_and_set_bit (RIO_BOARD_INTR_LOCK, &HostP->locks)) {
-    printk (KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", 
-            (int) ptr, HostP->Ivec);
-    return IRQ_HANDLED;
-  }
-
-  RIOServiceHost(p, HostP, irq);
-
-  rio_dprintk ( RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", 
-                (int) ptr, HostP->Type);
-
-  clear_bit (RIO_BOARD_INTR_LOCK, &HostP->locks);
-  rio_dprintk (RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", 
-               irq, HostP->Ivec); 
-  func_exit ();
-  return IRQ_HANDLED;
+       rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n");
+       if (HostP->Ivec == irq) {
+               /* Tell the card we've noticed the interrupt. */
+               rio_reset_interrupt(HostP);
+       }
+
+       if ((HostP->Flags & RUN_STATE) != RC_RUNNING)
+               return IRQ_HANDLED;
+
+       if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) {
+               printk(KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", (int) ptr, HostP->Ivec);
+               return IRQ_HANDLED;
+       }
+
+       RIOServiceHost(p, HostP, irq);
+
+       rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", (int) ptr, HostP->Type);
+
+       clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks);
+       rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec);
+       func_exit();
+       return IRQ_HANDLED;
 }
 
 
-static void rio_pollfunc (unsigned long data)
+static void rio_pollfunc(unsigned long data)
 {
-  func_enter ();
+       func_enter();
 
-  rio_interrupt (0, &p->RIOHosts[data], NULL);
-  p->RIOHosts[data].timer.expires = jiffies + rio_poll;
-  add_timer (&p->RIOHosts[data].timer);
+       rio_interrupt(0, &p->RIOHosts[data], NULL);
+       p->RIOHosts[data].timer.expires = jiffies + rio_poll;
+       add_timer(&p->RIOHosts[data].timer);
 
-  func_exit ();
+       func_exit();
 }
 
 
@@ -481,106 +489,106 @@ static void rio_pollfunc (unsigned long data)
 /* Ehhm. I don't know how to fiddle with interrupts on the Specialix 
    cards. ....   Hmm. Ok I figured it out. You don't.  -- REW */
 
-static void rio_disable_tx_interrupts (void * ptr) 
+static void rio_disable_tx_interrupts(void *ptr)
 {
-  func_enter();
+       func_enter();
 
-  /*  port->gs.flags &= ~GS_TX_INTEN; */
+       /*  port->gs.flags &= ~GS_TX_INTEN; */
 
-  func_exit();
+       func_exit();
 }
 
 
-static void rio_enable_tx_interrupts (void * ptr) 
+static void rio_enable_tx_interrupts(void *ptr)
 {
-  struct Port *PortP = ptr;
-  /* int hn; */
+       struct Port *PortP = ptr;
+       /* int hn; */
 
-  func_enter();
+       func_enter();
 
-  /* hn = PortP->HostP - p->RIOHosts;
+       /* hn = PortP->HostP - p->RIOHosts;
 
-     rio_dprintk (RIO_DEBUG_TTY, "Pushing host %d\n", hn);
-     rio_interrupt (-1,(void *) hn, NULL); */
+          rio_dprintk (RIO_DEBUG_TTY, "Pushing host %d\n", hn);
+          rio_interrupt (-1,(void *) hn, NULL); */
 
-  RIOTxEnable((char *) PortP);
+       RIOTxEnable((char *) PortP);
 
-  /* 
-   * In general we cannot count on "tx empty" interrupts, although
-   * the interrupt routine seems to be able to tell the difference. 
-   */
-  PortP->gs.flags &= ~GS_TX_INTEN;
+       /*
+        * In general we cannot count on "tx empty" interrupts, although
+        * the interrupt routine seems to be able to tell the difference.
+        */
+       PortP->gs.flags &= ~GS_TX_INTEN;
 
-  func_exit();
+       func_exit();
 }
 
 
-static void rio_disable_rx_interrupts (void * ptr) 
+static void rio_disable_rx_interrupts(void *ptr)
 {
-  func_enter();
-  func_exit();
+       func_enter();
+       func_exit();
 }
 
-static void rio_enable_rx_interrupts (void * ptr) 
+static void rio_enable_rx_interrupts(void *ptr)
 {
-  /*  struct rio_port *port = ptr; */
-  func_enter();
-  func_exit();
+       /*  struct rio_port *port = ptr; */
+       func_enter();
+       func_exit();
 }
 
 
 /* Jeez. Isn't this simple?  */
-static int rio_get_CD (void * ptr) 
+static int rio_get_CD(void *ptr)
 {
-  struct Port *PortP = ptr;
-  int rv;
+       struct Port *PortP = ptr;
+       int rv;
+
+       func_enter();
+       rv = (PortP->ModemState & MSVR1_CD) != 0;
 
-  func_enter();
-  rv = (PortP->ModemState & MSVR1_CD) != 0;
+       rio_dprintk(RIO_DEBUG_INIT, "Getting CD status: %d\n", rv);
 
-  rio_dprintk (RIO_DEBUG_INIT, "Getting CD status: %d\n", rv);
-  
-  func_exit();  
-  return rv;
+       func_exit();
+       return rv;
 }
 
 
 /* Jeez. Isn't this simple? Actually, we can sync with the actual port
    by just pushing stuff into the queue going to the port... */
-static int rio_chars_in_buffer (void * ptr) 
+static int rio_chars_in_buffer(void *ptr)
 {
-  func_enter();
+       func_enter();
 
-  func_exit();  
-  return 0;
+       func_exit();
+       return 0;
 }
 
 
 /* Nothing special here... */
-static void rio_shutdown_port (void * ptr) 
+static void rio_shutdown_port(void *ptr)
 {
-  struct Port *PortP;
+       struct Port *PortP;
 
-  func_enter();
+       func_enter();
 
-  PortP = (struct Port *)ptr;
-  PortP->gs.tty = NULL;
+       PortP = (struct Port *) ptr;
+       PortP->gs.tty = NULL;
 #if 0
-  port->gs.flags &= ~ GS_ACTIVE;
-  if (!port->gs.tty) {
-    rio_dprintk (RIO_DBUG_TTY, "No tty.\n");
-    return;
-  }
-  if (!port->gs.tty->termios) {
-    rio_dprintk (RIO_DEBUG_TTY, "No termios.\n");
-    return;
-  }
-  if (port->gs.tty->termios->c_cflag & HUPCL) {
-    rio_setsignals (port, 0, 0);
-  }
+       port->gs.flags &= ~GS_ACTIVE;
+       if (!port->gs.tty) {
+               rio_dprintk(RIO_DBUG_TTY, "No tty.\n");
+               return;
+       }
+       if (!port->gs.tty->termios) {
+               rio_dprintk(RIO_DEBUG_TTY, "No termios.\n");
+               return;
+       }
+       if (port->gs.tty->termios->c_cflag & HUPCL) {
+               rio_setsignals(port, 0, 0);
+       }
 #endif
 
-  func_exit();
+       func_exit();
 }
 
 
@@ -591,16 +599,16 @@ static void rio_shutdown_port (void * ptr)
    running minicom on a serial port that is driven by a modularized
    driver. Have the modem hangup. Then remove the driver module. Then
    exit minicom.  I expect an "oops".  -- REW */
-static void rio_hungup (void *ptr)
+static void rio_hungup(void *ptr)
 {
-  struct Port *PortP;
+       struct Port *PortP;
+
+       func_enter();
 
-  func_enter();
-  
-  PortP = (struct Port *)ptr;
-  PortP->gs.tty = NULL;
+       PortP = (struct Port *) ptr;
+       PortP->gs.tty = NULL;
 
-  func_exit ();
+       func_exit();
 }
 
 
@@ -608,146 +616,135 @@ static void rio_hungup (void *ptr)
    this. 
    rs_close (...){save_flags;cli;real_close();dec_use_count;restore_flags;}
  */
-static void rio_close (void *ptr)
+static void rio_close(void *ptr)
 {
-  struct Port *PortP;
+       struct Port *PortP;
 
-  func_enter ();
+       func_enter();
 
-  PortP = (struct Port *)ptr;
+       PortP = (struct Port *) ptr;
 
-  riotclose (ptr);
+       riotclose(ptr);
 
-  if(PortP->gs.count) {
-    printk (KERN_ERR "WARNING port count:%d\n", PortP->gs.count);
-    PortP->gs.count = 0; 
-  }                
+       if (PortP->gs.count) {
+               printk(KERN_ERR "WARNING port count:%d\n", PortP->gs.count);
+               PortP->gs.count = 0;
+       }
 
-  PortP->gs.tty = NULL;
-  func_exit ();
+       PortP->gs.tty = NULL;
+       func_exit();
 }
 
 
 
-static int rio_fw_ioctl (struct inode *inode, struct file *filp,
-                        unsigned int cmd, unsigned long arg)
+static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
 {
-  int rc = 0;
-  func_enter();
+       int rc = 0;
+       func_enter();
 
-  /* The "dev" argument isn't used. */
-  rc = riocontrol (p, 0, cmd, (void *)arg, capable(CAP_SYS_ADMIN));
+       /* The "dev" argument isn't used. */
+       rc = riocontrol(p, 0, cmd, (void *) arg, capable(CAP_SYS_ADMIN));
 
-  func_exit ();
-  return rc;
+       func_exit();
+       return rc;
 }
 
-extern int RIOShortCommand(struct rio_info *p, struct Port *PortP,
-               int command, int len, int arg);
+extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
 
-static int rio_ioctl (struct tty_struct * tty, struct file * filp, 
-                     unsigned int cmd, unsigned long arg)
+static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg)
 {
-  int rc;
-  struct Port *PortP;
-  int ival;
+       int rc;
+       struct Port *PortP;
+       int ival;
 
-  func_enter();
+       func_enter();
 
-  PortP = (struct Port *)tty->driver_data;
+       PortP = (struct Port *) tty->driver_data;
 
-  rc  = 0;
-  switch (cmd) {
+       rc = 0;
+       switch (cmd) {
 #if 0
-  case TIOCGSOFTCAR:
-    rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0),
-                  (unsigned int *) arg);
-    break;
+       case TIOCGSOFTCAR:
+               rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), (unsigned int *) arg);
+               break;
 #endif
-  case TIOCSSOFTCAR:
-    if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
-      tty->termios->c_cflag =
-        (tty->termios->c_cflag & ~CLOCAL) |
-        (ival ? CLOCAL : 0);
-    }
-    break;
-  case TIOCGSERIAL:
-    rc = -EFAULT;
-    if (access_ok(VERIFY_WRITE, (void *) arg,
-                          sizeof(struct serial_struct)))
-      rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg);
-    break;
-  case TCSBRK:
-    if ( PortP->State & RIO_DELETED ) {
-      rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n");
-      rc = -EIO;      
-    } else {
-      if (RIOShortCommand(p, PortP, SBREAK, 2, 250) == RIO_FAIL) {
-         rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
-         rc = -EIO;
-      }          
-    }
-    break;
-  case TCSBRKP:
-    if ( PortP->State & RIO_DELETED ) {
-      rio_dprintk (RIO_DEBUG_TTY, "BREAK on deleted RTA\n");
-      rc = -EIO;      
-    } else {
-      int l;
-      l = arg?arg*100:250;
-      if (l > 255) l = 255;
-      if (RIOShortCommand(p, PortP, SBREAK, 2, arg?arg*100:250) == RIO_FAIL) {
-         rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
-         rc = -EIO;
-      }          
-    }
-    break;
-  case TIOCSSERIAL:
-    rc = -EFAULT;
-    if (access_ok(VERIFY_READ, (void *) arg,
-                          sizeof(struct serial_struct)))
-      rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg);
-    break;
+       case TIOCSSOFTCAR:
+               if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
+                       tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0);
+               }
+               break;
+       case TIOCGSERIAL:
+               rc = -EFAULT;
+               if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(struct serial_struct)))
+                       rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg);
+               break;
+       case TCSBRK:
+               if (PortP->State & RIO_DELETED) {
+                       rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n");
+                       rc = -EIO;
+               } else {
+                       if (RIOShortCommand(p, PortP, SBREAK, 2, 250) == RIO_FAIL) {
+                               rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
+                               rc = -EIO;
+                       }
+               }
+               break;
+       case TCSBRKP:
+               if (PortP->State & RIO_DELETED) {
+                       rio_dprintk(RIO_DEBUG_TTY, "BREAK on deleted RTA\n");
+                       rc = -EIO;
+               } else {
+                       int l;
+                       l = arg ? arg * 100 : 250;
+                       if (l > 255)
+                               l = 255;
+                       if (RIOShortCommand(p, PortP, SBREAK, 2, arg ? arg * 100 : 250) == RIO_FAIL) {
+                               rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
+                               rc = -EIO;
+                       }
+               }
+               break;
+       case TIOCSSERIAL:
+               rc = -EFAULT;
+               if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct)))
+                       rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg);
+               break;
 #if 0
-  /*
-   * note: these IOCTLs no longer reach here.  Use
-   * tiocmset/tiocmget driver methods instead.  The
-   * #if 0 disablement predates this comment.
-   */
-  case TIOCMGET:
-    rc = -EFAULT;
-    if (access_ok(VERIFY_WRITE, (void *) arg,
-                          sizeof(unsigned int))) {
-      rc = 0;
-      ival = rio_getsignals(port);
-      put_user(ival, (unsigned int *) arg);
-    }
-    break;
-  case TIOCMBIS:
-    if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
-      rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1),
-                           ((ival & TIOCM_RTS) ? 1 : -1));
-    }
-    break;
-  case TIOCMBIC:
-    if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
-      rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1),
-                           ((ival & TIOCM_RTS) ? 0 : -1));
-    }
-    break;
-  case TIOCMSET:
-    if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
-      rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0),
-                           ((ival & TIOCM_RTS) ? 1 : 0));
-    }
-    break;
+               /*
+                * note: these IOCTLs no longer reach here.  Use
+                * tiocmset/tiocmget driver methods instead.  The
+                * #if 0 disablement predates this comment.
+                */
+       case TIOCMGET:
+               rc = -EFAULT;
+               if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(unsigned int))) {
+                       rc = 0;
+                       ival = rio_getsignals(port);
+                       put_user(ival, (unsigned int *) arg);
+               }
+               break;
+       case TIOCMBIS:
+               if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
+                       rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : -1), ((ival & TIOCM_RTS) ? 1 : -1));
+               }
+               break;
+       case TIOCMBIC:
+               if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
+                       rio_setsignals(port, ((ival & TIOCM_DTR) ? 0 : -1), ((ival & TIOCM_RTS) ? 0 : -1));
+               }
+               break;
+       case TIOCMSET:
+               if ((rc = get_user(ival, (unsigned int *) arg)) == 0) {
+                       rio_setsignals(port, ((ival & TIOCM_DTR) ? 1 : 0), ((ival & TIOCM_RTS) ? 1 : 0));
+               }
+               break;
 #endif
-  default:
-    rc = -ENOIOCTLCMD;
-    break;
-  }
-  func_exit();
-  return rc;
+       default:
+               rc = -ENOIOCTLCMD;
+               break;
+       }
+       func_exit();
+       return rc;
 }
 
 
@@ -767,37 +764,37 @@ static int rio_ioctl (struct tty_struct * tty, struct file * filp,
  * flow control scheme is in use for that port. -- Simon Allen
  */
 
-static void rio_throttle (struct tty_struct * tty)
+static void rio_throttle(struct tty_struct *tty)
 {
-  struct Port *port = (struct Port *)tty->driver_data;
-  
-  func_enter();
-  /* If the port is using any type of input flow
-   * control then throttle the port.
-   */
-
-  if((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty)) ) {
-    port->State |= RIO_THROTTLE_RX;
-  }
-
-  func_exit();
+       struct Port *port = (struct Port *) tty->driver_data;
+
+       func_enter();
+       /* If the port is using any type of input flow
+        * control then throttle the port.
+        */
+
+       if ((tty->termios->c_cflag & CRTSCTS) || (I_IXOFF(tty))) {
+               port->State |= RIO_THROTTLE_RX;
+       }
+
+       func_exit();
 }
 
 
-static void rio_unthrottle (struct tty_struct * tty)
+static void rio_unthrottle(struct tty_struct *tty)
 {
-  struct Port *port = (struct Port *)tty->driver_data;
+       struct Port *port = (struct Port *) tty->driver_data;
 
-  func_enter();
-  /* Always unthrottle even if flow control is not enabled on
-   * this port in case we disabled flow control while the port
-   * was throttled
-   */
+       func_enter();
+       /* Always unthrottle even if flow control is not enabled on
+        * this port in case we disabled flow control while the port
+        * was throttled
+        */
 
-  port->State &= ~RIO_THROTTLE_RX;
+       port->State &= ~RIO_THROTTLE_RX;
 
-  func_exit();
-  return;
+       func_exit();
+       return;
 }
 
 
@@ -809,35 +806,34 @@ static void rio_unthrottle (struct tty_struct * tty)
  * ********************************************************************** */
 
 
-static struct vpd_prom *get_VPD_PROM (struct Host *hp)
+static struct vpd_prom *get_VPD_PROM(struct Host *hp)
 {
-  static struct vpd_prom vpdp;
-  char *p;
-  int i;
+       static struct vpd_prom vpdp;
+       char *p;
+       int i;
+
+       func_enter();
+       rio_dprintk(RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", hp->Caddr + RIO_VPD_ROM);
 
-  func_enter();
-  rio_dprintk (RIO_DEBUG_PROBE, "Going to verify vpd prom at %p.\n", 
-              hp->Caddr + RIO_VPD_ROM);
+       p = (char *) &vpdp;
+       for (i = 0; i < sizeof(struct vpd_prom); i++)
+               *p++ = readb(hp->Caddr + RIO_VPD_ROM + i * 2);
+       /* read_rio_byte (hp, RIO_VPD_ROM + i*2); */
 
-  p = (char *) &vpdp;
-  for (i=0;i< sizeof (struct vpd_prom);i++)
-    *p++ = readb (hp->Caddr+RIO_VPD_ROM + i*2);
-      /* read_rio_byte (hp, RIO_VPD_ROM + i*2); */
+       /* Terminate the identifier string.
+        *** requires one extra byte in struct vpd_prom *** */
+       *p++ = 0;
 
-  /* Terminate the identifier string. 
-     *** requires one extra byte in struct vpd_prom *** */
-  *p++=0; 
+       if (rio_debug & RIO_DEBUG_PROBE)
+               my_hd((char *) &vpdp, 0x20);
 
-  if (rio_debug & RIO_DEBUG_PROBE)
-    my_hd ((char *)&vpdp, 0x20);
-  
-  func_exit();
+       func_exit();
 
-  return &vpdp;
+       return &vpdp;
 }
 
 static struct tty_operations rio_ops = {
-       .open  = riotopen,
+       .open = riotopen,
        .close = gs_close,
        .write = gs_write,
        .put_char = gs_put_char,
@@ -889,7 +885,7 @@ static int rio_init_drivers(void)
        rio_driver2->flags = TTY_DRIVER_REAL_RAW;
        tty_set_operations(rio_driver2, &rio_ops);
 
-       rio_dprintk (RIO_DEBUG_INIT, "set_termios = %p\n", gs_set_termios);
+       rio_dprintk(RIO_DEBUG_INIT, "set_termios = %p\n", gs_set_termios);
 
        if ((error = tty_register_driver(rio_driver)))
                goto out2;
@@ -897,116 +893,111 @@ static int rio_init_drivers(void)
                goto out3;
        func_exit();
        return 0;
-out3:
+      out3:
        tty_unregister_driver(rio_driver);
-out2:
+      out2:
        put_tty_driver(rio_driver2);
-out1:
+      out1:
        put_tty_driver(rio_driver);
-out:
-       printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n",
-            error);
+      out:
+       printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n", error);
        return 1;
 }
 
 
-static void * ckmalloc (int size)
+static void *ckmalloc(int size)
 {
-  void *p;
+       void *p;
 
-  p = kmalloc(size, GFP_KERNEL);
-  if (p) 
-    memset(p, 0, size);
-  return p;
+       p = kmalloc(size, GFP_KERNEL);
+       if (p)
+               memset(p, 0, size);
+       return p;
 }
 
 
 
-static int rio_init_datastructures (void)
+static int rio_init_datastructures(void)
 {
-  int i;
-  struct Port *port;
-  func_enter();
-
-  /* Many drivers statically allocate the maximum number of ports
-     There is no reason not to allocate them dynamically. Is there? -- REW */
-  /* However, the RIO driver allows users to configure their first
-     RTA as the ports numbered 504-511. We therefore need to allocate 
-     the whole range. :-(   -- REW */
-  
+       int i;
+       struct Port *port;
+       func_enter();
+
+       /* Many drivers statically allocate the maximum number of ports
+          There is no reason not to allocate them dynamically. Is there? -- REW */
+       /* However, the RIO driver allows users to configure their first
+          RTA as the ports numbered 504-511. We therefore need to allocate
+          the whole range. :-(   -- REW */
+
 #define RI_SZ   sizeof(struct rio_info)
 #define HOST_SZ sizeof(struct Host)
 #define PORT_SZ sizeof(struct Port *)
 #define TMIO_SZ sizeof(struct termios *)
-  rio_dprintk (RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", 
-               RI_SZ, 
-               RIO_HOSTS * HOST_SZ,
-               RIO_PORTS * PORT_SZ,
-               RIO_PORTS * TMIO_SZ,
-               RIO_PORTS * TMIO_SZ);
-  
-  if (!(p                  = ckmalloc (              RI_SZ))) goto free0;
-  if (!(p->RIOHosts        = ckmalloc (RIO_HOSTS * HOST_SZ))) goto free1;
-  if (!(p->RIOPortp        = ckmalloc (RIO_PORTS * PORT_SZ))) goto free2;
-  p->RIOConf = RIOConf;
-  rio_dprintk (RIO_DEBUG_INIT, "Got : %p %p %p\n", 
-               p, p->RIOHosts, p->RIOPortp);
+       rio_dprintk(RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ);
+
+       if (!(p = ckmalloc(RI_SZ)))
+               goto free0;
+       if (!(p->RIOHosts = ckmalloc(RIO_HOSTS * HOST_SZ)))
+               goto free1;
+       if (!(p->RIOPortp = ckmalloc(RIO_PORTS * PORT_SZ)))
+               goto free2;
+       p->RIOConf = RIOConf;
+       rio_dprintk(RIO_DEBUG_INIT, "Got : %p %p %p\n", p, p->RIOHosts, p->RIOPortp);
 
 #if 1
-  for (i = 0; i < RIO_PORTS; i++) {
-    port = p->RIOPortp[i] = ckmalloc (sizeof (struct Port));
-    if (!port) {
-      goto free6;
-    }
-    rio_dprintk (RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped);
-    port->PortNum = i;
-    port->gs.magic = RIO_MAGIC;
-    port->gs.close_delay = HZ/2;
-    port->gs.closing_wait = 30 * HZ;
-    port->gs.rd = &rio_real_driver;
-    spin_lock_init(&port->portSem);
-    /*
-     * Initializing wait queue
-     */
-    init_waitqueue_head(&port->gs.open_wait);
-    init_waitqueue_head(&port->gs.close_wait);
-  }
+       for (i = 0; i < RIO_PORTS; i++) {
+               port = p->RIOPortp[i] = ckmalloc(sizeof(struct Port));
+               if (!port) {
+                       goto free6;
+               }
+               rio_dprintk(RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped);
+               port->PortNum = i;
+               port->gs.magic = RIO_MAGIC;
+               port->gs.close_delay = HZ / 2;
+               port->gs.closing_wait = 30 * HZ;
+               port->gs.rd = &rio_real_driver;
+               spin_lock_init(&port->portSem);
+               /*
+                * Initializing wait queue
+                */
+               init_waitqueue_head(&port->gs.open_wait);
+               init_waitqueue_head(&port->gs.close_wait);
+       }
 #else
-  /* We could postpone initializing them to when they are configured. */
+       /* We could postpone initializing them to when they are configured. */
 #endif
 
 
-  
-  if (rio_debug & RIO_DEBUG_INIT) {
-    my_hd (&rio_real_driver, sizeof (rio_real_driver));
-  }
 
-  
-  func_exit();
-  return 0;
+       if (rio_debug & RIO_DEBUG_INIT) {
+               my_hd(&rio_real_driver, sizeof(rio_real_driver));
+       }
+
 
- free6:for (i--;i>=0;i--)
-        kfree (p->RIOPortp[i]);
+       func_exit();
+       return 0;
+
+      free6:for (i--; i >= 0; i--)
+               kfree(p->RIOPortp[i]);
 /*free5:
  free4:
- free3:*/kfree (p->RIOPortp);
- free2:kfree (p->RIOHosts);
- free1:
-  rio_dprintk (RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", 
-                      p, p->RIOHosts, p->RIOPortp);
-  kfree(p);                  
- free0:
-  return -ENOMEM;
+ free3:*/ kfree(p->RIOPortp);
+      free2:kfree(p->RIOHosts);
+      free1:
+       rio_dprintk(RIO_DEBUG_INIT, "Not enough memory! %p %p %p\n", p, p->RIOHosts, p->RIOPortp);
+       kfree(p);
+      free0:
+       return -ENOMEM;
 }
 
-static void  __exit rio_release_drivers(void)
+static void __exit rio_release_drivers(void)
 {
-  func_enter();
-  tty_unregister_driver(rio_driver2);
-  tty_unregister_driver(rio_driver);
-  put_tty_driver(rio_driver2);
-  put_tty_driver(rio_driver);
-  func_exit();
+       func_enter();
+       tty_unregister_driver(rio_driver2);
+       tty_unregister_driver(rio_driver);
+       put_tty_driver(rio_driver2);
+       put_tty_driver(rio_driver);
+       func_exit();
 }
 
 
@@ -1017,7 +1008,7 @@ static void  __exit rio_release_drivers(void)
     There is another bit besides Bit 17. Turning that bit off
     (on boards shipped with the fix in the eeprom) results in a 
     hang on the next access to the card. 
- */
 */
 
  /******************************************************** 
  * Setting bit 17 in the CNTRL register of the PLX 9050  * 
@@ -1030,319 +1021,293 @@ static void  __exit rio_release_drivers(void)
    EEprom.  As the bit is read/write for the CPU, we can fix it here,
    if we detect that it isn't set correctly. -- REW */
 
-static void fix_rio_pci (struct pci_dev *pdev)
+static void fix_rio_pci(struct pci_dev *pdev)
 {
-  unsigned int hwbase;
-  unsigned long rebase;
-  unsigned int t;
+       unsigned int hwbase;
+       unsigned long rebase;
+       unsigned int t;
 
 #define CNTRL_REG_OFFSET        0x50
 #define CNTRL_REG_GOODVALUE     0x18260000
 
-  pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase);
-  hwbase &= PCI_BASE_ADDRESS_MEM_MASK;
-  rebase =  (ulong) ioremap(hwbase, 0x80);
-  t = readl (rebase + CNTRL_REG_OFFSET);
-  if (t != CNTRL_REG_GOODVALUE) {
-    printk (KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", 
-            t, CNTRL_REG_GOODVALUE); 
-    writel (CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET);  
-  }
-  iounmap((char*) rebase);
+       pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase);
+       hwbase &= PCI_BASE_ADDRESS_MEM_MASK;
+       rebase = (ulong) ioremap(hwbase, 0x80);
+       t = readl(rebase + CNTRL_REG_OFFSET);
+       if (t != CNTRL_REG_GOODVALUE) {
+               printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE);
+               writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET);
+       }
+       iounmap((char *) rebase);
 }
 #endif
 
 
-static int __init rio_init(void) 
+static int __init rio_init(void)
 {
-  int found = 0;
-  int i;
-  struct Host *hp;
-  int retval;
-  struct vpd_prom *vpdp;
-  int okboard;
+       int found = 0;
+       int i;
+       struct Host *hp;
+       int retval;
+       struct vpd_prom *vpdp;
+       int okboard;
 
 #ifdef CONFIG_PCI
-  struct pci_dev *pdev = NULL;
-  unsigned int tint;
-  unsigned short tshort;
+       struct pci_dev *pdev = NULL;
+       unsigned int tint;
+       unsigned short tshort;
 #endif
 
-  func_enter();
-  rio_dprintk (RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", 
-              rio_debug);
-
-  if (abs ((long) (&rio_debug) - rio_debug) < 0x10000) {
-    printk (KERN_WARNING "rio: rio_debug is an address, instead of a value. "
-            "Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug);
-    rio_debug=-1;
-  }
-
-  if (misc_register(&rio_fw_device) < 0) {
-    printk(KERN_ERR "RIO: Unable to register firmware loader driver.\n");
-    return -EIO;
-  }
-
-  retval = rio_init_datastructures ();
-  if (retval < 0) {
-    misc_deregister(&rio_fw_device);
-    return retval;
-  }
-
+       func_enter();
+       rio_dprintk(RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n", rio_debug);
+
+       if (abs((long) (&rio_debug) - rio_debug) < 0x10000) {
+               printk(KERN_WARNING "rio: rio_debug is an address, instead of a value. " "Assuming -1. Was %x/%p.\n", rio_debug, &rio_debug);
+               rio_debug = -1;
+       }
+
+       if (misc_register(&rio_fw_device) < 0) {
+               printk(KERN_ERR "RIO: Unable to register firmware loader driver.\n");
+               return -EIO;
+       }
+
+       retval = rio_init_datastructures();
+       if (retval < 0) {
+               misc_deregister(&rio_fw_device);
+               return retval;
+       }
 #ifdef CONFIG_PCI
-    /* First look for the JET devices: */
-    while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX,
-                                    PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, 
-                                    pdev))) {
-       if (pci_enable_device(pdev)) continue;
-
-      /* Specialix has a whole bunch of cards with
-         0x2000 as the device ID. They say its because
-         the standard requires it. Stupid standard. */
-      /* It seems that reading a word doesn't work reliably on 2.0.
-         Also, reading a non-aligned dword doesn't work. So we read the
-         whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID)
-         ourselves */
-      /* I don't know why the define doesn't work, constant 0x2c does --REW */ 
-      pci_read_config_dword (pdev, 0x2c, &tint);
-      tshort = (tint >> 16) & 0xffff;
-      rio_dprintk (RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint);
-      if (tshort != 0x0100) {
-        rio_dprintk (RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", 
-                    tshort);
-        continue;
-      }
-      rio_dprintk (RIO_DEBUG_PROBE, "cp1\n");
-
-      pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint);
-
-      hp = &p->RIOHosts[p->RIONumHosts];
-      hp->PaddrP =  tint & PCI_BASE_ADDRESS_MEM_MASK;
-      hp->Ivec = pdev->irq;
-      if (((1 << hp->Ivec) & rio_irqmask) == 0)
-              hp->Ivec = 0;
-      hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
-      hp->CardP        = (struct DpRam *) hp->Caddr;
-      hp->Type  = RIO_PCI;
-      hp->Copy  = rio_pcicopy; 
-      hp->Mode  = RIO_PCI_BOOT_FROM_RAM;
-      spin_lock_init(&hp->HostLock);
-      rio_reset_interrupt (hp);
-      rio_start_card_running (hp);
-
-      rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n",
-                   (void *)p->RIOHosts[p->RIONumHosts].PaddrP,
-                   p->RIOHosts[p->RIONumHosts].Caddr);
-      if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP,
-                        p->RIOHosts[p->RIONumHosts].Caddr, 
-                        RIO_PCI, 0 ) == RIO_SUCCESS) {
-              rio_dprintk (RIO_DEBUG_INIT, "Done RIOBoardTest\n");
-              WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
-              p->RIOHosts[p->RIONumHosts].UniqueNum  =
-                      ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) &0xFF)<< 0)|
-                      ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) &0xFF)<< 8)|
-                      ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) &0xFF)<<16)|
-                      ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) &0xFF)<<24);
-              rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n",
-                           p->RIOHosts[p->RIONumHosts].UniqueNum);
-              
-              fix_rio_pci (pdev);
-              p->RIOLastPCISearch = RIO_SUCCESS;
-              p->RIONumHosts++;
-              found++;
-      } else {
-              iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr));
-      }
-    }
-    
-    /* Then look for the older PCI card.... : */
-
-  /* These older PCI cards have problems (only byte-mode access is
-     supported), which makes them a bit awkward to support. 
-     They also have problems sharing interrupts. Be careful. 
-     (The driver now refuses to share interrupts for these
-     cards. This should be sufficient).
-  */
-
-    /* Then look for the older RIO/PCI devices: */
-    while ((pdev = pci_get_device (PCI_VENDOR_ID_SPECIALIX,
-                                    PCI_DEVICE_ID_SPECIALIX_RIO, 
-                                    pdev))) {
-       if (pci_enable_device(pdev)) continue;
+       /* First look for the JET devices: */
+       while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, pdev))) {
+               if (pci_enable_device(pdev))
+                       continue;
+
+               /* Specialix has a whole bunch of cards with
+                  0x2000 as the device ID. They say its because
+                  the standard requires it. Stupid standard. */
+               /* It seems that reading a word doesn't work reliably on 2.0.
+                  Also, reading a non-aligned dword doesn't work. So we read the
+                  whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID)
+                  ourselves */
+               /* I don't know why the define doesn't work, constant 0x2c does --REW */
+               pci_read_config_dword(pdev, 0x2c, &tint);
+               tshort = (tint >> 16) & 0xffff;
+               rio_dprintk(RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint);
+               if (tshort != 0x0100) {
+                       rio_dprintk(RIO_DEBUG_PROBE, "But it's not a RIO card (%d)...\n", tshort);
+                       continue;
+               }
+               rio_dprintk(RIO_DEBUG_PROBE, "cp1\n");
+
+               pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint);
+
+               hp = &p->RIOHosts[p->RIONumHosts];
+               hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK;
+               hp->Ivec = pdev->irq;
+               if (((1 << hp->Ivec) & rio_irqmask) == 0)
+                       hp->Ivec = 0;
+               hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
+               hp->CardP = (struct DpRam *) hp->Caddr;
+               hp->Type = RIO_PCI;
+               hp->Copy = rio_pcicopy;
+               hp->Mode = RIO_PCI_BOOT_FROM_RAM;
+               spin_lock_init(&hp->HostLock);
+               rio_reset_interrupt(hp);
+               rio_start_card_running(hp);
+
+               rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr);
+               if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) {
+                       rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n");
+                       WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
+                       p->RIOHosts[p->RIONumHosts].UniqueNum =
+                           ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) |
+                           ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24);
+                       rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
+
+                       fix_rio_pci(pdev);
+                       p->RIOLastPCISearch = RIO_SUCCESS;
+                       p->RIONumHosts++;
+                       found++;
+               } else {
+                       iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr));
+               }
+       }
+
+       /* Then look for the older PCI card.... : */
+
+       /* These older PCI cards have problems (only byte-mode access is
+          supported), which makes them a bit awkward to support.
+          They also have problems sharing interrupts. Be careful.
+          (The driver now refuses to share interrupts for these
+          cards. This should be sufficient).
+        */
+
+       /* Then look for the older RIO/PCI devices: */
+       while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_RIO, pdev))) {
+               if (pci_enable_device(pdev))
+                       continue;
 
 #ifdef CONFIG_RIO_OLDPCI
-      pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint);
-
-      hp = &p->RIOHosts[p->RIONumHosts];
-      hp->PaddrP =  tint & PCI_BASE_ADDRESS_MEM_MASK;
-      hp->Ivec = pdev->irq;
-      if (((1 << hp->Ivec) & rio_irqmask) == 0) 
-       hp->Ivec = 0;
-      hp->Ivec |= 0x8000; /* Mark as non-sharable */
-      hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
-      hp->CardP        = (struct DpRam *) hp->Caddr;
-      hp->Type  = RIO_PCI;
-      hp->Copy  = rio_pcicopy;
-      hp->Mode  = RIO_PCI_BOOT_FROM_RAM;
-      spin_lock_init(&hp->HostLock);
-
-      rio_dprintk (RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec);
-      rio_dprintk (RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode);
-
-      rio_reset_interrupt (hp);
-      rio_start_card_running (hp);
-       rio_dprintk (RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n",
-                   (void *)p->RIOHosts[p->RIONumHosts].PaddrP,
-                   p->RIOHosts[p->RIONumHosts].Caddr);
-      if (RIOBoardTest( p->RIOHosts[p->RIONumHosts].PaddrP,
-                        p->RIOHosts[p->RIONumHosts].Caddr, 
-                        RIO_PCI, 0 ) == RIO_SUCCESS) {
-        WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
-        p->RIOHosts[p->RIONumHosts].UniqueNum  =
-          ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) &0xFF)<< 0)|
-          ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) &0xFF)<< 8)|
-          ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) &0xFF)<<16)|
-          ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) &0xFF)<<24);
-        rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n",
-                   p->RIOHosts[p->RIONumHosts].UniqueNum);
-
-        p->RIOLastPCISearch = RIO_SUCCESS;
-        p->RIONumHosts++;
-        found++;
-      } else {
-        iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr));
-      }
+               pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint);
+
+               hp = &p->RIOHosts[p->RIONumHosts];
+               hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK;
+               hp->Ivec = pdev->irq;
+               if (((1 << hp->Ivec) & rio_irqmask) == 0)
+                       hp->Ivec = 0;
+               hp->Ivec |= 0x8000;     /* Mark as non-sharable */
+               hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
+               hp->CardP = (struct DpRam *) hp->Caddr;
+               hp->Type = RIO_PCI;
+               hp->Copy = rio_pcicopy;
+               hp->Mode = RIO_PCI_BOOT_FROM_RAM;
+               spin_lock_init(&hp->HostLock);
+
+               rio_dprintk(RIO_DEBUG_PROBE, "Ivec: %x\n", hp->Ivec);
+               rio_dprintk(RIO_DEBUG_PROBE, "Mode: %x\n", hp->Mode);
+
+               rio_reset_interrupt(hp);
+               rio_start_card_running(hp);
+               rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr);
+               if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) {
+                       WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff);
+                       p->RIOHosts[p->RIONumHosts].UniqueNum =
+                           ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) |
+                           ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24);
+                       rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
+
+                       p->RIOLastPCISearch = RIO_SUCCESS;
+                       p->RIONumHosts++;
+                       found++;
+               } else {
+                       iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr));
+               }
 #else
-      printk (KERN_ERR "Found an older RIO PCI card, but the driver is not "
-              "compiled to support it.\n");
+               printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n");
 #endif
-    }
-#endif /* PCI */
-
-  /* Now probe for ISA cards... */
-  for (i=0;i<NR_RIO_ADDRS;i++) {
-    hp = &p->RIOHosts[p->RIONumHosts];
-    hp->PaddrP = rio_probe_addrs[i];
-    /* There was something about the IRQs of these cards. 'Forget what.--REW */
-    hp->Ivec = 0;
-    hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
-    hp->CardP = (struct DpRam *) hp->Caddr;
-    hp->Type = RIO_AT;
-    hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL
-                             * -- YES! this is now a normal copy. Only the 
-                             * old PCI card uses the special PCI copy. 
-                             * Moreover, the ISA card will work with the 
-                             * special PCI copy anyway. -- REW */
-    hp->Mode = 0;
-    spin_lock_init(&hp->HostLock);
-
-    vpdp = get_VPD_PROM (hp);
-    rio_dprintk (RIO_DEBUG_PROBE, "Got VPD ROM\n");
-    okboard = 0;
-    if ((strncmp (vpdp->identifier, RIO_ISA_IDENT, 16) == 0) ||
-        (strncmp (vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) ||
-        (strncmp (vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) {
-      /* Board is present... */
-      if (RIOBoardTest (hp->PaddrP, 
-                        hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) {
-        /* ... and feeling fine!!!! */
-        rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n",
-                   p->RIOHosts[p->RIONumHosts].UniqueNum);
-        if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) {        
-          rio_dprintk (RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n",
-                       p->RIONumHosts, 
-                       p->RIOHosts[p->RIONumHosts-1].UniqueNum);
-          okboard++;
-          found++;
-        }
-      }
-
-    if (!okboard)
-      iounmap ((char*) (hp->Caddr));
-    }
-  }
-
-
-  for (i=0;i<p->RIONumHosts;i++) {
-    hp = &p->RIOHosts[i];
-    if (hp->Ivec) {
-      int mode = SA_SHIRQ;
-      if (hp->Ivec & 0x8000) {mode = 0; hp->Ivec &= 0x7fff;}
-      rio_dprintk (RIO_DEBUG_INIT, "Requesting interrupt hp: %p rio_interrupt: %d Mode: %x\n", hp,hp->Ivec, hp->Mode);
-      retval = request_irq (hp->Ivec, rio_interrupt, mode, "rio", hp);
-      rio_dprintk (RIO_DEBUG_INIT, "Return value from request_irq: %d\n", retval);
-      if (retval) {
-              printk(KERN_ERR "rio: Cannot allocate irq %d.\n", hp->Ivec);
-              hp->Ivec = 0;
-      }
-      rio_dprintk (RIO_DEBUG_INIT, "Got irq %d.\n", hp->Ivec);
-      if (hp->Ivec != 0){
-              rio_dprintk (RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n"); 
-              hp->Mode |= RIO_PCI_INT_ENABLE;
-      } else
-              hp->Mode &= !RIO_PCI_INT_ENABLE;
-      rio_dprintk (RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode);
-      rio_start_card_running (hp);
-    }
-    /* Init the timer "always" to make sure that it can safely be 
-       deleted when we unload... */
-
-    init_timer (&hp->timer);
-    if (!hp->Ivec) {
-      rio_dprintk (RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", 
-                   rio_poll);
-      hp->timer.data = i;
-      hp->timer.function = rio_pollfunc;
-      hp->timer.expires = jiffies + rio_poll;
-      add_timer (&hp->timer);
-    }
-  }
-
-  if (found) {
-    rio_dprintk (RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found);
-    rio_init_drivers ();
-  } else {
-    /* deregister the misc device we created earlier */
-    misc_deregister(&rio_fw_device);
-  }
-
-  func_exit();
-  return found?0:-EIO;
+       }
+#endif                         /* PCI */
+
+       /* Now probe for ISA cards... */
+       for (i = 0; i < NR_RIO_ADDRS; i++) {
+               hp = &p->RIOHosts[p->RIONumHosts];
+               hp->PaddrP = rio_probe_addrs[i];
+               /* There was something about the IRQs of these cards. 'Forget what.--REW */
+               hp->Ivec = 0;
+               hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN);
+               hp->CardP = (struct DpRam *) hp->Caddr;
+               hp->Type = RIO_AT;
+               hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL
+                                        * -- YES! this is now a normal copy. Only the
+                                        * old PCI card uses the special PCI copy.
+                                        * Moreover, the ISA card will work with the
+                                        * special PCI copy anyway. -- REW */
+               hp->Mode = 0;
+               spin_lock_init(&hp->HostLock);
+
+               vpdp = get_VPD_PROM(hp);
+               rio_dprintk(RIO_DEBUG_PROBE, "Got VPD ROM\n");
+               okboard = 0;
+               if ((strncmp(vpdp->identifier, RIO_ISA_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) {
+                       /* Board is present... */
+                       if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) {
+                               /* ... and feeling fine!!!! */
+                               rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
+                               if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) {
+                                       rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, host%d uniqid = %x.\n", p->RIONumHosts, p->RIOHosts[p->RIONumHosts - 1].UniqueNum);
+                                       okboard++;
+                                       found++;
+                               }
+                       }
+
+                       if (!okboard)
+                               iounmap((char *) (hp->Caddr));
+               }
+       }
+
+
+       for (i = 0; i < p->RIONumHosts; i++) {
+               hp = &p->RIOHosts[i];
+               if (hp->Ivec) {
+                       int mode = SA_SHIRQ;
+                       if (hp->Ivec & 0x8000) {
+                               mode = 0;
+                               hp->Ivec &= 0x7fff;
+                       }
+                       rio_dprintk(RIO_DEBUG_INIT, "Requesting interrupt hp: %p rio_interrupt: %d Mode: %x\n", hp, hp->Ivec, hp->Mode);
+                       retval = request_irq(hp->Ivec, rio_interrupt, mode, "rio", hp);
+                       rio_dprintk(RIO_DEBUG_INIT, "Return value from request_irq: %d\n", retval);
+                       if (retval) {
+                               printk(KERN_ERR "rio: Cannot allocate irq %d.\n", hp->Ivec);
+                               hp->Ivec = 0;
+                       }
+                       rio_dprintk(RIO_DEBUG_INIT, "Got irq %d.\n", hp->Ivec);
+                       if (hp->Ivec != 0) {
+                               rio_dprintk(RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n");
+                               hp->Mode |= RIO_PCI_INT_ENABLE;
+                       } else
+                               hp->Mode &= !RIO_PCI_INT_ENABLE;
+                       rio_dprintk(RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode);
+                       rio_start_card_running(hp);
+               }
+               /* Init the timer "always" to make sure that it can safely be
+                  deleted when we unload... */
+
+               init_timer(&hp->timer);
+               if (!hp->Ivec) {
+                       rio_dprintk(RIO_DEBUG_INIT, "Starting polling at %dj intervals.\n", rio_poll);
+                       hp->timer.data = i;
+                       hp->timer.function = rio_pollfunc;
+                       hp->timer.expires = jiffies + rio_poll;
+                       add_timer(&hp->timer);
+               }
+       }
+
+       if (found) {
+               rio_dprintk(RIO_DEBUG_INIT, "rio: total of %d boards detected.\n", found);
+               rio_init_drivers();
+       } else {
+               /* deregister the misc device we created earlier */
+               misc_deregister(&rio_fw_device);
+       }
+
+       func_exit();
+       return found ? 0 : -EIO;
 }
 
 
-static void __exit rio_exit (void)
+static void __exit rio_exit(void)
 {
-  int i; 
-  struct Host *hp;
-  
-  func_enter();
+       int i;
+       struct Host *hp;
+
+       func_enter();
 
-  for (i=0,hp=p->RIOHosts;i<p->RIONumHosts;i++, hp++) {
-    RIOHostReset (hp->Type, hp->CardP, hp->Slot);
-    if (hp->Ivec) {
-      free_irq (hp->Ivec, hp);
-      rio_dprintk (RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec);
-    }
-    /* It is safe/allowed to del_timer a non-active timer */
-    del_timer (&hp->timer);
-  }
+       for (i = 0, hp = p->RIOHosts; i < p->RIONumHosts; i++, hp++) {
+               RIOHostReset(hp->Type, hp->CardP, hp->Slot);
+               if (hp->Ivec) {
+                       free_irq(hp->Ivec, hp);
+                       rio_dprintk(RIO_DEBUG_INIT, "freed irq %d.\n", hp->Ivec);
+               }
+               /* It is safe/allowed to del_timer a non-active timer */
+               del_timer(&hp->timer);
+       }
 
-  if (misc_deregister(&rio_fw_device) < 0) {
-    printk (KERN_INFO "rio: couldn't deregister control-device\n");
-  }
+       if (misc_deregister(&rio_fw_device) < 0) {
+               printk(KERN_INFO "rio: couldn't deregister control-device\n");
+       }
 
 
-  rio_dprintk (RIO_DEBUG_CLEANUP, "Cleaning up drivers\n");
+       rio_dprintk(RIO_DEBUG_CLEANUP, "Cleaning up drivers\n");
 
-  rio_release_drivers ();
+       rio_release_drivers();
 
-  /* Release dynamically allocated memory */
-  kfree (p->RIOPortp);
-  kfree (p->RIOHosts);
-  kfree (p);
+       /* Release dynamically allocated memory */
+       kfree(p->RIOPortp);
+       kfree(p->RIOHosts);
+       kfree(p);
 
-  func_exit();
+       func_exit();
 }
 
 module_init(rio_init);
@@ -1368,4 +1333,3 @@ module_exit(rio_exit);
  * tab-width: 8
  * End:
  */
-
index 1fba19d5b66ac613c8c875557e3e71eeae8fb592..4ce77fb1fae5f9befb1e9a794de4c422e1a25f66 100644 (file)
 
 
 struct vpd_prom {
-  unsigned short id;
-  char hwrev;
-  char hwass;
-  int uniqid;
-  char myear;
-  char mweek;
-  char hw_feature[5];
-  char oem_id;
-  char identifier[16];
+       unsigned short id;
+       char hwrev;
+       char hwass;
+       int uniqid;
+       char myear;
+       char mweek;
+       char hw_feature[5];
+       char oem_id;
+       char identifier[16];
 };
 
 
@@ -75,13 +75,13 @@ struct vpd_prom {
       (L_ISIG(tty)))
 
 
-#endif /* __KERNEL__ */
+#endif                         /* __KERNEL__ */
 
 
 #define RIO_BOARD_INTR_LOCK  1
 
 
-#ifndef RIOCTL_MISC_MINOR 
+#ifndef RIOCTL_MISC_MINOR
 /* Allow others to gather this into "major.h" or something like that */
 #define RIOCTL_MISC_MINOR    169
 #endif
@@ -121,39 +121,39 @@ struct vpd_prom {
             spin_unlock_irqrestore(sem, flags)
 
 #define rio_spin_lock(sem) \
-            spin_lock(sem) 
+            spin_lock(sem)
 
 #define rio_spin_unlock(sem) \
-            spin_unlock(sem) 
+            spin_unlock(sem)
 
 #endif
 
 
 
 #ifdef CONFIG_RIO_OLDPCI
-static inline void *rio_memcpy_toio (void *dummy, void *dest, void *source, int n)
+static inline void *rio_memcpy_toio(void *dummy, void *dest, void *source, int n)
 {
-  char *dst = dest;
-  char *src = source;
+       char *dst = dest;
+       char *src = source;
 
-  while (n--) {
-    writeb (*src++, dst++);
-    (void) readb (dummy);
-  }
+       while (n--) {
+               writeb(*src++, dst++);
+               (void) readb(dummy);
+       }
 
-  return dest;
+       return dest;
 }
 
 
-static inline void *rio_memcpy_fromio (void *dest, void *source, int n)
+static inline void *rio_memcpy_fromio(void *dest, void *source, int n)
 {
-  char *dst = dest;
-  char *src = source;
+       char *dst = dest;
+       char *src = source;
 
-  while (n--) 
-    *dst++ = readb (src++);
+       while (n--)
+               *dst++ = readb(src++);
 
-  return dest;
+       return dest;
 }
 
 #else
@@ -179,9 +179,8 @@ static inline void *rio_memcpy_fromio (void *dest, void *source, int n)
 #define func_exit()  rio_dprintk (RIO_DEBUG_FLOW, "rio: exit  %s\n", __FUNCTION__)
 #define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s (port %d)\n",__FUNCTION__, port->line)
 #else
-#define rio_dprintk(f, str...) /* nothing */
+#define rio_dprintk(f, str...) /* nothing */
 #define func_enter()
 #define func_exit()
 #define func_enter2()
 #endif
-
index cc6ac6a98f658bf6421ce9aaa1c4453fce888a2c..822c071a693bc54566d4b3f230a618617707c510 100644 (file)
@@ -35,7 +35,7 @@
 
 */
 
-#ifndef        _rioboard_h                             /* If RIOBOARD.H not already defined */
+#ifndef        _rioboard_h             /* If RIOBOARD.H not already defined */
 #define        _rioboard_h    1
 
 /*****************************************************************************
@@ -46,7 +46,7 @@
 
 /* Hardware Registers... */
 
-#define        RIO_REG_BASE    0x7C00                  /* Base of control registers */
+#define        RIO_REG_BASE    0x7C00  /* Base of control registers */
 
 #define        RIO_CONFIG      RIO_REG_BASE + 0x0000   /* WRITE: Configuration Register */
 #define        RIO_INTSET      RIO_REG_BASE + 0x0080   /* WRITE: Interrupt Set */
 #define        RIO_RESETSTAT   RIO_REG_BASE + 0x0100   /* READ: Reset Status (Jet boards only) */
 
 /* RIO_VPD_ROM definitions... */
-#define        VPD_SLX_ID1     0x00                    /* READ: Specialix Identifier #1 */
-#define        VPD_SLX_ID2     0x01                    /* READ: Specialix Identifier #2 */
-#define        VPD_HW_REV      0x02                    /* READ: Hardware Revision */
-#define        VPD_HW_ASSEM    0x03                    /* READ: Hardware Assembly Level */
-#define        VPD_UNIQUEID4   0x04                    /* READ: Unique Identifier #4 */
-#define        VPD_UNIQUEID3   0x05                    /* READ: Unique Identifier #3 */
-#define        VPD_UNIQUEID2   0x06                    /* READ: Unique Identifier #2 */
-#define        VPD_UNIQUEID1   0x07                    /* READ: Unique Identifier #1 */
-#define        VPD_MANU_YEAR   0x08                    /* READ: Year Of Manufacture (0 = 1970) */
-#define        VPD_MANU_WEEK   0x09                    /* READ: Week Of Manufacture (0 = week 1 Jan) */
-#define        VPD_HWFEATURE1  0x0A                    /* READ: Hardware Feature Byte 1 */
-#define        VPD_HWFEATURE2  0x0B                    /* READ: Hardware Feature Byte 2 */
-#define        VPD_HWFEATURE3  0x0C                    /* READ: Hardware Feature Byte 3 */
-#define        VPD_HWFEATURE4  0x0D                    /* READ: Hardware Feature Byte 4 */
-#define        VPD_HWFEATURE5  0x0E                    /* READ: Hardware Feature Byte 5 */
-#define        VPD_OEMID       0x0F                    /* READ: OEM Identifier */
-#define        VPD_IDENT       0x10                    /* READ: Identifier string (16 bytes) */
+#define        VPD_SLX_ID1     0x00    /* READ: Specialix Identifier #1 */
+#define        VPD_SLX_ID2     0x01    /* READ: Specialix Identifier #2 */
+#define        VPD_HW_REV      0x02    /* READ: Hardware Revision */
+#define        VPD_HW_ASSEM    0x03    /* READ: Hardware Assembly Level */
+#define        VPD_UNIQUEID4   0x04    /* READ: Unique Identifier #4 */
+#define        VPD_UNIQUEID3   0x05    /* READ: Unique Identifier #3 */
+#define        VPD_UNIQUEID2   0x06    /* READ: Unique Identifier #2 */
+#define        VPD_UNIQUEID1   0x07    /* READ: Unique Identifier #1 */
+#define        VPD_MANU_YEAR   0x08    /* READ: Year Of Manufacture (0 = 1970) */
+#define        VPD_MANU_WEEK   0x09    /* READ: Week Of Manufacture (0 = week 1 Jan) */
+#define        VPD_HWFEATURE1  0x0A    /* READ: Hardware Feature Byte 1 */
+#define        VPD_HWFEATURE2  0x0B    /* READ: Hardware Feature Byte 2 */
+#define        VPD_HWFEATURE3  0x0C    /* READ: Hardware Feature Byte 3 */
+#define        VPD_HWFEATURE4  0x0D    /* READ: Hardware Feature Byte 4 */
+#define        VPD_HWFEATURE5  0x0E    /* READ: Hardware Feature Byte 5 */
+#define        VPD_OEMID       0x0F    /* READ: OEM Identifier */
+#define        VPD_IDENT       0x10    /* READ: Identifier string (16 bytes) */
 #define        VPD_IDENT_LEN   0x10
 
 /* VPD ROM Definitions... */
 #define        SLX_ID1         0x4D
 #define        SLX_ID2         0x98
 
-#define        PRODUCT_ID(a)   ((a>>4)&0xF)            /* Use to obtain Product ID from VPD_UNIQUEID1 */
+#define        PRODUCT_ID(a)   ((a>>4)&0xF)    /* Use to obtain Product ID from VPD_UNIQUEID1 */
 
 #define        ID_SX_ISA       0x2
 #define        ID_RIO_EISA     0x3
 
 /* Firmware load position... */
 
-#define        FIRMWARELOADADDR        0x7C00          /* Firmware is loaded _before_ this address */
+#define        FIRMWARELOADADDR        0x7C00  /* Firmware is loaded _before_ this address */
 
 /*****************************************************************************
 *****************************                    *****************************
 /* Control Register Definitions... */
 #define        RIO_ISA_IDENT   "JBJGPGGHINSMJPJR"
 
-#define        RIO_ISA_CFG_BOOTRAM     0x01            /* Boot from RAM, else Link */
-#define        RIO_ISA_CFG_BUSENABLE   0x02            /* Enable processor bus */
-#define        RIO_ISA_CFG_IRQMASK     0x30            /* Interrupt mask */
-#define          RIO_ISA_CFG_IRQ12     0x10            /* Interrupt Level 12 */
-#define          RIO_ISA_CFG_IRQ11     0x20            /* Interrupt Level 11 */
-#define          RIO_ISA_CFG_IRQ9      0x30            /* Interrupt Level 9 */
-#define        RIO_ISA_CFG_LINK20      0x40            /* 20Mbps link, else 10Mbps */
-#define        RIO_ISA_CFG_WAITSTATE0  0x80            /* 0 waitstates, else 1 */
+#define        RIO_ISA_CFG_BOOTRAM     0x01    /* Boot from RAM, else Link */
+#define        RIO_ISA_CFG_BUSENABLE   0x02    /* Enable processor bus */
+#define        RIO_ISA_CFG_IRQMASK     0x30    /* Interrupt mask */
+#define          RIO_ISA_CFG_IRQ12     0x10    /* Interrupt Level 12 */
+#define          RIO_ISA_CFG_IRQ11     0x20    /* Interrupt Level 11 */
+#define          RIO_ISA_CFG_IRQ9      0x30    /* Interrupt Level 9 */
+#define        RIO_ISA_CFG_LINK20      0x40    /* 20Mbps link, else 10Mbps */
+#define        RIO_ISA_CFG_WAITSTATE0  0x80    /* 0 waitstates, else 1 */
 
 /*****************************************************************************
 *****************************                    *****************************
 /* Control Register Definitions... */
 #define        RIO_ISA2_IDENT  "JBJGPGGHINSMJPJR"
 
-#define        RIO_ISA2_CFG_BOOTRAM    0x01            /* Boot from RAM, else Link */
-#define        RIO_ISA2_CFG_BUSENABLE  0x02            /* Enable processor bus */
-#define        RIO_ISA2_CFG_INTENABLE  0x04            /* Interrupt enable, else disable */
-#define        RIO_ISA2_CFG_16BIT      0x08            /* 16bit mode, else 8bit */
-#define        RIO_ISA2_CFG_IRQMASK    0x30            /* Interrupt mask */
-#define          RIO_ISA2_CFG_IRQ15    0x00            /* Interrupt Level 15 */
-#define          RIO_ISA2_CFG_IRQ12    0x10            /* Interrupt Level 12 */
-#define          RIO_ISA2_CFG_IRQ11    0x20            /* Interrupt Level 11 */
-#define          RIO_ISA2_CFG_IRQ9     0x30            /* Interrupt Level 9 */
-#define        RIO_ISA2_CFG_LINK20     0x40            /* 20Mbps link, else 10Mbps */
-#define        RIO_ISA2_CFG_WAITSTATE0 0x80            /* 0 waitstates, else 1 */
+#define        RIO_ISA2_CFG_BOOTRAM    0x01    /* Boot from RAM, else Link */
+#define        RIO_ISA2_CFG_BUSENABLE  0x02    /* Enable processor bus */
+#define        RIO_ISA2_CFG_INTENABLE  0x04    /* Interrupt enable, else disable */
+#define        RIO_ISA2_CFG_16BIT      0x08    /* 16bit mode, else 8bit */
+#define        RIO_ISA2_CFG_IRQMASK    0x30    /* Interrupt mask */
+#define          RIO_ISA2_CFG_IRQ15    0x00    /* Interrupt Level 15 */
+#define          RIO_ISA2_CFG_IRQ12    0x10    /* Interrupt Level 12 */
+#define          RIO_ISA2_CFG_IRQ11    0x20    /* Interrupt Level 11 */
+#define          RIO_ISA2_CFG_IRQ9     0x30    /* Interrupt Level 9 */
+#define        RIO_ISA2_CFG_LINK20     0x40    /* 20Mbps link, else 10Mbps */
+#define        RIO_ISA2_CFG_WAITSTATE0 0x80    /* 0 waitstates, else 1 */
 
 /*****************************************************************************
 *****************************                   ******************************
 /* Control Register Definitions... */
 #define        RIO_ISA3_IDENT  "JET HOST BY KEV#"
 
-#define        RIO_ISA3_CFG_BUSENABLE  0x02            /* Enable processor bus */
-#define        RIO_ISA3_CFG_INTENABLE  0x04            /* Interrupt enable, else disable */
-#define        RIO_ISA32_CFG_IRQMASK   0xF30           /* Interrupt mask */
-#define          RIO_ISA3_CFG_IRQ15    0xF0            /* Interrupt Level 15 */
-#define          RIO_ISA3_CFG_IRQ12    0xC0            /* Interrupt Level 12 */
-#define          RIO_ISA3_CFG_IRQ11    0xB0            /* Interrupt Level 11 */
-#define          RIO_ISA3_CFG_IRQ10    0xA0            /* Interrupt Level 10 */
-#define          RIO_ISA3_CFG_IRQ9     0x90            /* Interrupt Level 9 */
+#define        RIO_ISA3_CFG_BUSENABLE  0x02    /* Enable processor bus */
+#define        RIO_ISA3_CFG_INTENABLE  0x04    /* Interrupt enable, else disable */
+#define        RIO_ISA32_CFG_IRQMASK   0xF30   /* Interrupt mask */
+#define          RIO_ISA3_CFG_IRQ15    0xF0    /* Interrupt Level 15 */
+#define          RIO_ISA3_CFG_IRQ12    0xC0    /* Interrupt Level 12 */
+#define          RIO_ISA3_CFG_IRQ11    0xB0    /* Interrupt Level 11 */
+#define          RIO_ISA3_CFG_IRQ10    0xA0    /* Interrupt Level 10 */
+#define          RIO_ISA3_CFG_IRQ9     0x90    /* Interrupt Level 9 */
 
 /*****************************************************************************
 *********************************             ********************************
 /* Control Register Definitions... */
 #define        RIO_MCA_IDENT   "JBJGPGGHINSMJPJR"
 
-#define        RIO_MCA_CFG_BOOTRAM     0x01            /* Boot from RAM, else Link */
-#define        RIO_MCA_CFG_BUSENABLE   0x02            /* Enable processor bus */
-#define        RIO_MCA_CFG_LINK20      0x40            /* 20Mbps link, else 10Mbps */
+#define        RIO_MCA_CFG_BOOTRAM     0x01    /* Boot from RAM, else Link */
+#define        RIO_MCA_CFG_BUSENABLE   0x02    /* Enable processor bus */
+#define        RIO_MCA_CFG_LINK20      0x40    /* 20Mbps link, else 10Mbps */
 
 /*****************************************************************************
 ********************************              ********************************
 #define        EISA_PRODUCT_NUMBER     0xC82
 #define        EISA_REVISION_NUMBER    0xC83
 #define        EISA_CARD_ENABLE        0xC84
-#define        EISA_VPD_UNIQUEID4      0xC88           /* READ: Unique Identifier #4 */
-#define        EISA_VPD_UNIQUEID3      0xC8A           /* READ: Unique Identifier #3 */
-#define        EISA_VPD_UNIQUEID2      0xC90           /* READ: Unique Identifier #2 */
-#define        EISA_VPD_UNIQUEID1      0xC92           /* READ: Unique Identifier #1 */
-#define        EISA_VPD_MANU_YEAR      0xC98           /* READ: Year Of Manufacture (0 = 1970) */
-#define        EISA_VPD_MANU_WEEK      0xC9A           /* READ: Week Of Manufacture (0 = week 1 Jan) */
+#define        EISA_VPD_UNIQUEID4      0xC88   /* READ: Unique Identifier #4 */
+#define        EISA_VPD_UNIQUEID3      0xC8A   /* READ: Unique Identifier #3 */
+#define        EISA_VPD_UNIQUEID2      0xC90   /* READ: Unique Identifier #2 */
+#define        EISA_VPD_UNIQUEID1      0xC92   /* READ: Unique Identifier #1 */
+#define        EISA_VPD_MANU_YEAR      0xC98   /* READ: Year Of Manufacture (0 = 1970) */
+#define        EISA_VPD_MANU_WEEK      0xC9A   /* READ: Week Of Manufacture (0 = week 1 Jan) */
 #define        EISA_MEM_ADDR_23_16     0xC00
 #define        EISA_MEM_ADDR_31_24     0xC01
-#define        EISA_RIO_CONFIG         0xC02           /* WRITE: Configuration Register */
-#define        EISA_RIO_INTSET         0xC03           /* WRITE: Interrupt Set */
-#define        EISA_RIO_INTRESET       0xC03           /* READ:  Interrupt Reset */
+#define        EISA_RIO_CONFIG         0xC02   /* WRITE: Configuration Register */
+#define        EISA_RIO_INTSET         0xC03   /* WRITE: Interrupt Set */
+#define        EISA_RIO_INTRESET       0xC03   /* READ:  Interrupt Reset */
 
 /* Control Register Definitions... */
-#define        RIO_EISA_CFG_BOOTRAM    0x01            /* Boot from RAM, else Link */
-#define        RIO_EISA_CFG_LINK20     0x02            /* 20Mbps link, else 10Mbps */
-#define        RIO_EISA_CFG_BUSENABLE  0x04            /* Enable processor bus */
-#define        RIO_EISA_CFG_PROCRUN    0x08            /* Processor running, else reset */
-#define        RIO_EISA_CFG_IRQMASK    0xF0            /* Interrupt mask */
-#define          RIO_EISA_CFG_IRQ15    0xF0            /* Interrupt Level 15 */
-#define          RIO_EISA_CFG_IRQ14    0xE0            /* Interrupt Level 14 */
-#define          RIO_EISA_CFG_IRQ12    0xC0            /* Interrupt Level 12 */
-#define          RIO_EISA_CFG_IRQ11    0xB0            /* Interrupt Level 11 */
-#define          RIO_EISA_CFG_IRQ10    0xA0            /* Interrupt Level 10 */
-#define          RIO_EISA_CFG_IRQ9     0x90            /* Interrupt Level 9 */
-#define          RIO_EISA_CFG_IRQ7     0x70            /* Interrupt Level 7 */
-#define          RIO_EISA_CFG_IRQ6     0x60            /* Interrupt Level 6 */
-#define          RIO_EISA_CFG_IRQ5     0x50            /* Interrupt Level 5 */
-#define          RIO_EISA_CFG_IRQ4     0x40            /* Interrupt Level 4 */
-#define          RIO_EISA_CFG_IRQ3     0x30            /* Interrupt Level 3 */
+#define        RIO_EISA_CFG_BOOTRAM    0x01    /* Boot from RAM, else Link */
+#define        RIO_EISA_CFG_LINK20     0x02    /* 20Mbps link, else 10Mbps */
+#define        RIO_EISA_CFG_BUSENABLE  0x04    /* Enable processor bus */
+#define        RIO_EISA_CFG_PROCRUN    0x08    /* Processor running, else reset */
+#define        RIO_EISA_CFG_IRQMASK    0xF0    /* Interrupt mask */
+#define          RIO_EISA_CFG_IRQ15    0xF0    /* Interrupt Level 15 */
+#define          RIO_EISA_CFG_IRQ14    0xE0    /* Interrupt Level 14 */
+#define          RIO_EISA_CFG_IRQ12    0xC0    /* Interrupt Level 12 */
+#define          RIO_EISA_CFG_IRQ11    0xB0    /* Interrupt Level 11 */
+#define          RIO_EISA_CFG_IRQ10    0xA0    /* Interrupt Level 10 */
+#define          RIO_EISA_CFG_IRQ9     0x90    /* Interrupt Level 9 */
+#define          RIO_EISA_CFG_IRQ7     0x70    /* Interrupt Level 7 */
+#define          RIO_EISA_CFG_IRQ6     0x60    /* Interrupt Level 6 */
+#define          RIO_EISA_CFG_IRQ5     0x50    /* Interrupt Level 5 */
+#define          RIO_EISA_CFG_IRQ4     0x40    /* Interrupt Level 4 */
+#define          RIO_EISA_CFG_IRQ3     0x30    /* Interrupt Level 3 */
 
 /*****************************************************************************
 ********************************              ********************************
 /* Control Register Definitions... */
 #define        RIO_SBUS_IDENT  "JBPGK#\0\0\0\0\0\0\0\0\0\0"
 
-#define        RIO_SBUS_CFG_BOOTRAM    0x01            /* Boot from RAM, else Link */
-#define        RIO_SBUS_CFG_BUSENABLE  0x02            /* Enable processor bus */
-#define        RIO_SBUS_CFG_INTENABLE  0x04            /* Interrupt enable, else disable */
-#define        RIO_SBUS_CFG_IRQMASK    0x38            /* Interrupt mask */
-#define          RIO_SBUS_CFG_IRQNONE  0x00            /* No Interrupt */
-#define          RIO_SBUS_CFG_IRQ7     0x38            /* Interrupt Level 7 */
-#define          RIO_SBUS_CFG_IRQ6     0x30            /* Interrupt Level 6 */
-#define          RIO_SBUS_CFG_IRQ5     0x28            /* Interrupt Level 5 */
-#define          RIO_SBUS_CFG_IRQ4     0x20            /* Interrupt Level 4 */
-#define          RIO_SBUS_CFG_IRQ3     0x18            /* Interrupt Level 3 */
-#define          RIO_SBUS_CFG_IRQ2     0x10            /* Interrupt Level 2 */
-#define          RIO_SBUS_CFG_IRQ1     0x08            /* Interrupt Level 1 */
-#define        RIO_SBUS_CFG_LINK20     0x40            /* 20Mbps link, else 10Mbps */
-#define        RIO_SBUS_CFG_PROC25     0x80            /* 25Mhz processor clock, else 20Mhz */
+#define        RIO_SBUS_CFG_BOOTRAM    0x01    /* Boot from RAM, else Link */
+#define        RIO_SBUS_CFG_BUSENABLE  0x02    /* Enable processor bus */
+#define        RIO_SBUS_CFG_INTENABLE  0x04    /* Interrupt enable, else disable */
+#define        RIO_SBUS_CFG_IRQMASK    0x38    /* Interrupt mask */
+#define          RIO_SBUS_CFG_IRQNONE  0x00    /* No Interrupt */
+#define          RIO_SBUS_CFG_IRQ7     0x38    /* Interrupt Level 7 */
+#define          RIO_SBUS_CFG_IRQ6     0x30    /* Interrupt Level 6 */
+#define          RIO_SBUS_CFG_IRQ5     0x28    /* Interrupt Level 5 */
+#define          RIO_SBUS_CFG_IRQ4     0x20    /* Interrupt Level 4 */
+#define          RIO_SBUS_CFG_IRQ3     0x18    /* Interrupt Level 3 */
+#define          RIO_SBUS_CFG_IRQ2     0x10    /* Interrupt Level 2 */
+#define          RIO_SBUS_CFG_IRQ1     0x08    /* Interrupt Level 1 */
+#define        RIO_SBUS_CFG_LINK20     0x40    /* 20Mbps link, else 10Mbps */
+#define        RIO_SBUS_CFG_PROC25     0x80    /* 25Mhz processor clock, else 20Mhz */
 
 /*****************************************************************************
 *********************************             ********************************
 /* Control Register Definitions... */
 #define        RIO_PCI_IDENT   "ECDDPGJGJHJRGSK#"
 
-#define        RIO_PCI_CFG_BOOTRAM     0x01            /* Boot from RAM, else Link */
-#define        RIO_PCI_CFG_BUSENABLE   0x02            /* Enable processor bus */
-#define        RIO_PCI_CFG_INTENABLE   0x04            /* Interrupt enable, else disable */
-#define        RIO_PCI_CFG_LINK20      0x40            /* 20Mbps link, else 10Mbps */
-#define        RIO_PCI_CFG_PROC25      0x80            /* 25Mhz processor clock, else 20Mhz */
+#define        RIO_PCI_CFG_BOOTRAM     0x01    /* Boot from RAM, else Link */
+#define        RIO_PCI_CFG_BUSENABLE   0x02    /* Enable processor bus */
+#define        RIO_PCI_CFG_INTENABLE   0x04    /* Interrupt enable, else disable */
+#define        RIO_PCI_CFG_LINK20      0x40    /* 20Mbps link, else 10Mbps */
+#define        RIO_PCI_CFG_PROC25      0x80    /* 25Mhz processor clock, else 20Mhz */
 
 /* PCI Definitions... */
-#define        SPX_VENDOR_ID           0x11CB          /* Assigned by the PCI SIG */
-#define        SPX_DEVICE_ID           0x8000          /* RIO bridge boards */
-#define        SPX_PLXDEVICE_ID        0x2000          /* PLX bridge boards */
+#define        SPX_VENDOR_ID           0x11CB  /* Assigned by the PCI SIG */
+#define        SPX_DEVICE_ID           0x8000  /* RIO bridge boards */
+#define        SPX_PLXDEVICE_ID        0x2000  /* PLX bridge boards */
 #define        SPX_SUB_VENDOR_ID       SPX_VENDOR_ID   /* Same as vendor id */
-#define        RIO_SUB_SYS_ID          0x0800          /* RIO PCI board */
+#define        RIO_SUB_SYS_ID          0x0800  /* RIO PCI board */
 
 /*****************************************************************************
 *****************************                   ******************************
 /* Control Register Definitions... */
 #define        RIO_PCI2_IDENT  "JET HOST BY KEV#"
 
-#define        RIO_PCI2_CFG_BUSENABLE  0x02            /* Enable processor bus */
-#define        RIO_PCI2_CFG_INTENABLE  0x04            /* Interrupt enable, else disable */
+#define        RIO_PCI2_CFG_BUSENABLE  0x02    /* Enable processor bus */
+#define        RIO_PCI2_CFG_INTENABLE  0x04    /* Interrupt enable, else disable */
 
 /* PCI Definitions... */
-#define        RIO2_SUB_SYS_ID         0x0100          /* RIO (Jet) PCI board */
+#define        RIO2_SUB_SYS_ID         0x0100  /* RIO (Jet) PCI board */
 
 #endif                                         /*_rioboard_h */
 
index 533085ec6f1bb3fb05aff76f35cb39d74b8d5140..b97dd9fdb6ba4e1a00578d8b03f85ab316ead9b5 100644 (file)
@@ -83,102 +83,98 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c       1.2";
 static struct IdentifyRta IdRta;
 static struct KillNeighbour KillUnit;
 
-int
-RIOFoadRta(struct Host *HostP, struct Map *MapP)
+int RIOFoadRta(struct Host *HostP, struct Map *MapP)
 {
        struct CmdBlk *CmdBlkP;
 
-       rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA\n");
+       rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA\n");
 
        CmdBlkP = RIOGetCmdBlk();
 
-       if ( !CmdBlkP ) {
-               rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n");
+       if (!CmdBlkP) {
+               rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n");
                return -ENXIO;
        }
 
        CmdBlkP->Packet.dest_unit = MapP->ID;
        CmdBlkP->Packet.dest_port = BOOT_RUP;
-       CmdBlkP->Packet.src_unit  = 0;
-       CmdBlkP->Packet.src_port  = BOOT_RUP;
-       CmdBlkP->Packet.len        = 0x84;
-       CmdBlkP->Packet.data[0]   = IFOAD;
-       CmdBlkP->Packet.data[1]   = 0;
-       CmdBlkP->Packet.data[2]   = IFOAD_MAGIC & 0xFF;
-       CmdBlkP->Packet.data[3]   = (IFOAD_MAGIC >> 8) & 0xFF;
-
-       if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) {
-               rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n");
+       CmdBlkP->Packet.src_unit = 0;
+       CmdBlkP->Packet.src_port = BOOT_RUP;
+       CmdBlkP->Packet.len = 0x84;
+       CmdBlkP->Packet.data[0] = IFOAD;
+       CmdBlkP->Packet.data[1] = 0;
+       CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF;
+       CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF;
+
+       if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
+               rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n");
                return -EIO;
        }
        return 0;
 }
 
-int
-RIOZombieRta(struct Host *HostP, struct Map *MapP)
+int RIOZombieRta(struct Host *HostP, struct Map *MapP)
 {
        struct CmdBlk *CmdBlkP;
 
-       rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA\n");
+       rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA\n");
 
        CmdBlkP = RIOGetCmdBlk();
 
-       if ( !CmdBlkP ) {
-               rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n");
+       if (!CmdBlkP) {
+               rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n");
                return -ENXIO;
        }
 
        CmdBlkP->Packet.dest_unit = MapP->ID;
        CmdBlkP->Packet.dest_port = BOOT_RUP;
-       CmdBlkP->Packet.src_unit  = 0;
-       CmdBlkP->Packet.src_port  = BOOT_RUP;
-       CmdBlkP->Packet.len        = 0x84;
-       CmdBlkP->Packet.data[0]   = ZOMBIE;
-       CmdBlkP->Packet.data[1]   = 0;
-       CmdBlkP->Packet.data[2]   = ZOMBIE_MAGIC & 0xFF;
-       CmdBlkP->Packet.data[3]   = (ZOMBIE_MAGIC >> 8) & 0xFF;
-
-       if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) {
-               rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n");
+       CmdBlkP->Packet.src_unit = 0;
+       CmdBlkP->Packet.src_port = BOOT_RUP;
+       CmdBlkP->Packet.len = 0x84;
+       CmdBlkP->Packet.data[0] = ZOMBIE;
+       CmdBlkP->Packet.data[1] = 0;
+       CmdBlkP->Packet.data[2] = ZOMBIE_MAGIC & 0xFF;
+       CmdBlkP->Packet.data[3] = (ZOMBIE_MAGIC >> 8) & 0xFF;
+
+       if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
+               rio_dprintk(RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n");
                return -EIO;
        }
        return 0;
 }
 
-int
-RIOCommandRta(struct rio_info *p, uint RtaUnique,
-       int (* func)(struct Host *HostP, struct Map *MapP))
+int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP))
 {
        uint Host;
 
-       rio_dprintk (RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int)func);
+       rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int) func);
 
-       if ( !RtaUnique )
-               return(0);
+       if (!RtaUnique)
+               return (0);
 
-       for ( Host = 0; Host < p->RIONumHosts; Host++ ) {
+       for (Host = 0; Host < p->RIONumHosts; Host++) {
                uint Rta;
                struct Host *HostP = &p->RIOHosts[Host];
 
-               for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) {
+               for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
                        struct Map *MapP = &HostP->Mapping[Rta];
 
-                       if ( MapP->RtaUniqueNum == RtaUnique ) {
+                       if (MapP->RtaUniqueNum == RtaUnique) {
                                uint Link;
 
                                /*
-                               ** now, lets just check we have a route to it...
-                               ** IF the routing stuff is working, then one of the
-                               ** topology entries for this unit will have a legit
-                               ** route *somewhere*. We care not where - if its got
-                               ** any connections, we can get to it.
-                               */
-                               for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) {
-                                       if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) {
+                                ** now, lets just check we have a route to it...
+                                ** IF the routing stuff is working, then one of the
+                                ** topology entries for this unit will have a legit
+                                ** route *somewhere*. We care not where - if its got
+                                ** any connections, we can get to it.
+                                */
+                               for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
+                                       if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) {
                                                /*
-                                               ** Its worth trying the operation...
-                                               */
-                                               return (*func)( HostP, MapP );
+                                                ** Its worth trying the operation...
+                                                */
+                                               return (*func) (HostP, MapP);
                                        }
                                }
                        }
@@ -188,60 +184,59 @@ RIOCommandRta(struct rio_info *p, uint RtaUnique,
 }
 
 
-int
-RIOIdentifyRta(struct rio_info *p, caddr_t arg)
+int RIOIdentifyRta(struct rio_info *p, caddr_t arg)
 {
        uint Host;
 
-       if ( copyin( (int)arg, (caddr_t)&IdRta, sizeof(IdRta) ) == COPYFAIL ) {
-               rio_dprintk (RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n");
+       if (copyin((int) arg, (caddr_t) & IdRta, sizeof(IdRta)) == COPYFAIL) {
+               rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n");
                p->RIOError.Error = COPYIN_FAILED;
                return -EFAULT;
        }
 
-       for ( Host = 0 ; Host < p->RIONumHosts; Host++ ) {
+       for (Host = 0; Host < p->RIONumHosts; Host++) {
                uint Rta;
                struct Host *HostP = &p->RIOHosts[Host];
 
-               for ( Rta = 0; Rta < RTAS_PER_HOST; Rta++ ) {
+               for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
                        struct Map *MapP = &HostP->Mapping[Rta];
 
-                       if ( MapP->RtaUniqueNum == IdRta.RtaUnique ) {
+                       if (MapP->RtaUniqueNum == IdRta.RtaUnique) {
                                uint Link;
                                /*
-                               ** now, lets just check we have a route to it...
-                               ** IF the routing stuff is working, then one of the
-                               ** topology entries for this unit will have a legit
-                               ** route *somewhere*. We care not where - if its got
-                               ** any connections, we can get to it.
-                               */
-                               for ( Link = 0; Link < LINKS_PER_UNIT; Link++ ) {
-                                       if ( MapP->Topology[Link].Unit <= (uchar)MAX_RUP ) {
+                                ** now, lets just check we have a route to it...
+                                ** IF the routing stuff is working, then one of the
+                                ** topology entries for this unit will have a legit
+                                ** route *somewhere*. We care not where - if its got
+                                ** any connections, we can get to it.
+                                */
+                               for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
+                                       if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) {
                                                /*
-                                               ** Its worth trying the operation...
-                                               */
+                                                ** Its worth trying the operation...
+                                                */
                                                struct CmdBlk *CmdBlkP;
 
-                                               rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA\n");
+                                               rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA\n");
 
                                                CmdBlkP = RIOGetCmdBlk();
 
-                                               if ( !CmdBlkP ) {
-                                                       rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n");
+                                               if (!CmdBlkP) {
+                                                       rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n");
                                                        return -ENXIO;
                                                }
-               
+
                                                CmdBlkP->Packet.dest_unit = MapP->ID;
                                                CmdBlkP->Packet.dest_port = BOOT_RUP;
-                                               CmdBlkP->Packet.src_unit  = 0;
-                                               CmdBlkP->Packet.src_port  = BOOT_RUP;
-                                               CmdBlkP->Packet.len        = 0x84;
-                                               CmdBlkP->Packet.data[0]   = IDENTIFY;
-                                               CmdBlkP->Packet.data[1]   = 0;
-                                               CmdBlkP->Packet.data[2]   = IdRta.ID;
-               
-                                               if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) {
-                                                       rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n");
+                                               CmdBlkP->Packet.src_unit = 0;
+                                               CmdBlkP->Packet.src_port = BOOT_RUP;
+                                               CmdBlkP->Packet.len = 0x84;
+                                               CmdBlkP->Packet.data[0] = IDENTIFY;
+                                               CmdBlkP->Packet.data[1] = 0;
+                                               CmdBlkP->Packet.data[2] = IdRta.ID;
+
+                                               if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
+                                                       rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n");
                                                        return -EIO;
                                                }
                                                return 0;
@@ -249,114 +244,110 @@ RIOIdentifyRta(struct rio_info *p, caddr_t arg)
                                }
                        }
                }
-       } 
+       }
        return -ENOENT;
 }
 
 
-int
-RIOKillNeighbour(struct rio_info *p, caddr_t arg)
+int RIOKillNeighbour(struct rio_info *p, caddr_t arg)
 {
        uint Host;
        uint ID;
        struct Host *HostP;
        struct CmdBlk *CmdBlkP;
 
-       rio_dprintk (RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n");
+       rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n");
 
-       if ( copyin( (int)arg, (caddr_t)&KillUnit, sizeof(KillUnit) ) == COPYFAIL ) {
-               rio_dprintk (RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n");
+       if (copyin((int) arg, (caddr_t) & KillUnit, sizeof(KillUnit)) == COPYFAIL) {
+               rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n");
                p->RIOError.Error = COPYIN_FAILED;
                return -EFAULT;
        }
 
-       if ( KillUnit.Link > 3 )
+       if (KillUnit.Link > 3)
                return -ENXIO;
+
        CmdBlkP = RIOGetCmdBlk();
 
-       if ( !CmdBlkP ) {
-               rio_dprintk (RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n");
+       if (!CmdBlkP) {
+               rio_dprintk(RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n");
                return -ENXIO;
        }
 
        CmdBlkP->Packet.dest_unit = 0;
-       CmdBlkP->Packet.src_unit  = 0;
+       CmdBlkP->Packet.src_unit = 0;
        CmdBlkP->Packet.dest_port = BOOT_RUP;
-       CmdBlkP->Packet.src_port  = BOOT_RUP;
-       CmdBlkP->Packet.len        = 0x84;
-       CmdBlkP->Packet.data[0]   = UFOAD;
-       CmdBlkP->Packet.data[1]   = KillUnit.Link;
-       CmdBlkP->Packet.data[2]   = UFOAD_MAGIC & 0xFF;
-       CmdBlkP->Packet.data[3]   = (UFOAD_MAGIC >> 8) & 0xFF;
-
-       for ( Host = 0; Host < p->RIONumHosts; Host++ ) {
+       CmdBlkP->Packet.src_port = BOOT_RUP;
+       CmdBlkP->Packet.len = 0x84;
+       CmdBlkP->Packet.data[0] = UFOAD;
+       CmdBlkP->Packet.data[1] = KillUnit.Link;
+       CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF;
+       CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF;
+
+       for (Host = 0; Host < p->RIONumHosts; Host++) {
                ID = 0;
                HostP = &p->RIOHosts[Host];
 
-               if ( HostP->UniqueNum == KillUnit.UniqueNum ) {
-                       if ( RIOQueueCmdBlk( HostP, RTAS_PER_HOST+KillUnit.Link,
-                                                       CmdBlkP) == RIO_FAIL ) {
-                               rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
+               if (HostP->UniqueNum == KillUnit.UniqueNum) {
+                       if (RIOQueueCmdBlk(HostP, RTAS_PER_HOST + KillUnit.Link, CmdBlkP) == RIO_FAIL) {
+                               rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
                                return -EIO;
                        }
                        return 0;
                }
 
-               for ( ID=0; ID < RTAS_PER_HOST; ID++ ) {
-                       if ( HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum ) {
-                               CmdBlkP->Packet.dest_unit = ID+1;
-                               if ( RIOQueueCmdBlk( HostP, ID, CmdBlkP) == RIO_FAIL ) {
-                                       rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
+               for (ID = 0; ID < RTAS_PER_HOST; ID++) {
+                       if (HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum) {
+                               CmdBlkP->Packet.dest_unit = ID + 1;
+                               if (RIOQueueCmdBlk(HostP, ID, CmdBlkP) == RIO_FAIL) {
+                                       rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
                                        return -EIO;
                                }
                                return 0;
                        }
                }
        }
-       RIOFreeCmdBlk( CmdBlkP );
+       RIOFreeCmdBlk(CmdBlkP);
        return -ENXIO;
 }
 
-int
-RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
+int RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
 {
        struct CmdBlk *CmdBlkP;
 
-       rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link);
+       rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link);
 
        CmdBlkP = RIOGetCmdBlk();
 
-       if ( !CmdBlkP ) {
-               rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n");
+       if (!CmdBlkP) {
+               rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n");
                return -ENXIO;
        }
 
        CmdBlkP->Packet.dest_unit = ID;
        CmdBlkP->Packet.dest_port = BOOT_RUP;
-       CmdBlkP->Packet.src_unit  = 0;
-       CmdBlkP->Packet.src_port  = BOOT_RUP;
-       CmdBlkP->Packet.len        = 0x84;
-       CmdBlkP->Packet.data[0]   = IWAIT;
-       CmdBlkP->Packet.data[1]   = Link;
-       CmdBlkP->Packet.data[2]   = IWAIT_MAGIC & 0xFF;
-       CmdBlkP->Packet.data[3]   = (IWAIT_MAGIC >> 8) & 0xFF;
-
-       if ( RIOQueueCmdBlk( HostP, ID - 1, CmdBlkP) == RIO_FAIL ) {
-               rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n");
+       CmdBlkP->Packet.src_unit = 0;
+       CmdBlkP->Packet.src_port = BOOT_RUP;
+       CmdBlkP->Packet.len = 0x84;
+       CmdBlkP->Packet.data[0] = IWAIT;
+       CmdBlkP->Packet.data[1] = Link;
+       CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF;
+       CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF;
+
+       if (RIOQueueCmdBlk(HostP, ID - 1, CmdBlkP) == RIO_FAIL) {
+               rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n");
                return -EIO;
        }
        return 0;
 }
 
-int
-RIOFoadWakeup(struct rio_info *p)
+int RIOFoadWakeup(struct rio_info *p)
 {
        int port;
        register struct Port *PortP;
        unsigned long flags;
 
-       for ( port=0; port<RIO_PORTS; port++) {
+       for (port = 0; port < RIO_PORTS; port++) {
                PortP = p->RIOPortp[port];
 
                rio_spin_lock_irqsave(&PortP->portSem, flags);
@@ -377,16 +368,15 @@ RIOFoadWakeup(struct rio_info *p)
                PortP->TxBufferOut = 0;
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
        }
-       return(0);
+       return (0);
 }
 
 /*
 ** Incoming command on the COMMAND_RUP to be processed.
 */
-static int
-RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
+static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
 {
-       struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data;
+       struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
        struct Port *PortP;
        struct UnixRup *UnixRupP;
        ushort SysPort;
@@ -395,128 +385,114 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
        ushort subCommand;
        unsigned long flags;
 
-       func_enter ();
+       func_enter();
 
 #ifdef CHECK
-       CheckHost( Host );
-       CheckHostP( HostP );
-       CheckPacketP( PacketP );
+       CheckHost(Host);
+       CheckHostP(HostP);
+       CheckPacketP(PacketP);
 #endif
 
        /*
-       ** 16 port RTA note:
-       ** Command rup packets coming from the RTA will have pkt->data[1] (which
-       ** translates to PktCmdP->PhbNum) set to the host port number for the
-       ** particular unit. To access the correct BaseSysPort for a 16 port RTA,
-       ** we can use PhbNum to get the rup number for the appropriate 8 port
-       ** block (for the first block, this should be equal to 'Rup').
-       */
-       rup = RBYTE(PktCmdP->PhbNum) / (ushort)PORTS_PER_RTA;
+        ** 16 port RTA note:
+        ** Command rup packets coming from the RTA will have pkt->data[1] (which
+        ** translates to PktCmdP->PhbNum) set to the host port number for the
+        ** particular unit. To access the correct BaseSysPort for a 16 port RTA,
+        ** we can use PhbNum to get the rup number for the appropriate 8 port
+        ** block (for the first block, this should be equal to 'Rup').
+        */
+       rup = RBYTE(PktCmdP->PhbNum) / (ushort) PORTS_PER_RTA;
        UnixRupP = &HostP->UnixRups[rup];
-       SysPort = UnixRupP->BaseSysPort + 
-                       (RBYTE(PktCmdP->PhbNum) % (ushort)PORTS_PER_RTA);
-       rio_dprintk (RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
+       SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA);
+       rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
 
 #ifdef CHECK
-       CheckRup( rup );
-       CheckUnixRupP( UnixRupP );
+       CheckRup(rup);
+       CheckUnixRupP(UnixRupP);
 #endif
-       if ( UnixRupP->BaseSysPort == NO_PORT ) {
-               rio_dprintk (RIO_DEBUG_CMD, "OBSCURE ERROR!\n");
-               rio_dprintk (RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n");
-               rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", 
-                            HostP-p->RIOHosts, HostP->Name );
-               rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: Rup number  0x%x\n", rup);
-
-               if ( Rup >= (ushort)MAX_RUP ) {
-                       rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n",
-                                    HostP->Mapping[Rup].Name);
+       if (UnixRupP->BaseSysPort == NO_PORT) {
+               rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n");
+               rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n");
+               rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", HostP - p->RIOHosts, HostP->Name);
+               rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number  0x%x\n", rup);
+
+               if (Rup >= (ushort) MAX_RUP) {
+                       rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name);
                } else
-                       rio_dprintk (RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", 
-                                    ('A' + Rup - MAX_RUP), HostP->Name);
-
-               rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n",
-                            PacketP->dest_unit, PacketP->dest_port );
-               rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Source   0x%x:0x%x\n",
-                            PacketP->src_unit, PacketP->src_port );
-               rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Length   0x%x (%d)\n", PacketP->len,PacketP->len );
-               rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Control         0x%x (%d)\n", PacketP->control, PacketP->control);
-               rio_dprintk (RIO_DEBUG_CMD, "PACKET information: Check     0x%x (%d)\n", PacketP->csum, PacketP->csum );
-               rio_dprintk (RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, "
-                                       "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command );
+                       rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name);
+
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", PacketP->dest_unit, PacketP->dest_port);
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source    0x%x:0x%x\n", PacketP->src_unit, PacketP->src_port);
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length    0x%x (%d)\n", PacketP->len, PacketP->len);
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control  0x%x (%d)\n", PacketP->control, PacketP->control);
+               rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check      0x%x (%d)\n", PacketP->csum, PacketP->csum);
+               rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command);
                return TRUE;
        }
-
 #ifdef CHECK
-       CheckSysPort( SysPort );
+       CheckSysPort(SysPort);
 #endif
-       PortP = p->RIOPortp[ SysPort ];
+       PortP = p->RIOPortp[SysPort];
        rio_spin_lock_irqsave(&PortP->portSem, flags);
-       switch( RBYTE(PktCmdP->Command) ) {
-               case BREAK_RECEIVED:
-                       rio_dprintk (RIO_DEBUG_CMD, "Received a break!\n");
-                       /* If the current line disc. is not multi-threading and
-                               the current processor is not the default, reset rup_intr
-                               and return FALSE to ensure that the command packet is
-                               not freed. */
-                       /* Call tmgr HANGUP HERE */
-                       /* Fix this later when every thing works !!!! RAMRAJ */
-                       gs_got_break (&PortP->gs);
+       switch (RBYTE(PktCmdP->Command)) {
+       case BREAK_RECEIVED:
+               rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n");
+               /* If the current line disc. is not multi-threading and
+                  the current processor is not the default, reset rup_intr
+                  and return FALSE to ensure that the command packet is
+                  not freed. */
+               /* Call tmgr HANGUP HERE */
+               /* Fix this later when every thing works !!!! RAMRAJ */
+               gs_got_break(&PortP->gs);
+               break;
+
+       case COMPLETE:
+               rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP - p->RIOHosts);
+               subCommand = 1;
+               switch (RBYTE(PktCmdP->SubCommand)) {
+               case MEMDUMP:
+                       rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr));
                        break;
+               case READ_REGISTER:
+                       rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr));
+                       p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST);
+                       break;
+               default:
+                       subCommand = 0;
+                       break;
+               }
+               if (subCommand)
+                       break;
+               rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", RBYTE(PktCmdP->PortStatus), PortP->PortState);
+               if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) {
+                       rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n");
+                       PortP->PortState = RBYTE(PktCmdP->PortStatus);
+                       /* What should we do here ...
+                          wakeup( &PortP->PortState );
+                        */
+               } else
+                       rio_dprintk(RIO_DEBUG_CMD, "No change\n");
 
-               case COMPLETE:
-                       rio_dprintk (RIO_DEBUG_CMD, "Command complete on phb %d host %d\n",
-                            RBYTE(PktCmdP->PhbNum), HostP-p->RIOHosts);
-                       subCommand = 1;
-                       switch (RBYTE(PktCmdP->SubCommand)) {
-                               case MEMDUMP :
-                       rio_dprintk (RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n",
-                                    RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr));
-                                       break;
-                               case READ_REGISTER :
-                       rio_dprintk (RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr));
-                                       p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST);
-                                       break;
-                               default :
-                                       subCommand = 0;
-                               break;
-                       }
-                       if (subCommand)
-                               break;
-                       rio_dprintk (RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n",
-                                    RBYTE(PktCmdP->PortStatus),PortP->PortState);
-                       if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) {
-                               rio_dprintk (RIO_DEBUG_CMD, "Mark status & wakeup\n");
-                               PortP->PortState = RBYTE(PktCmdP->PortStatus);
-                               /* What should we do here ...
-                               wakeup( &PortP->PortState );
-                               */
-               } else 
-                       rio_dprintk (RIO_DEBUG_CMD, "No change\n");
-
-                       /* FALLTHROUGH */
-               case MODEM_STATUS:
+               /* FALLTHROUGH */
+       case MODEM_STATUS:
+               /*
+                ** Knock out the tbusy and tstop bits, as these are not relevant
+                ** to the check for modem status change (they're just there because
+                ** it's a convenient place to put them!).
+                */
+               ReportedModemStatus = RBYTE(PktCmdP->ModemStatus);
+               if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) {
+                       rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
                        /*
-                       ** Knock out the tbusy and tstop bits, as these are not relevant
-                       ** to the check for modem status change (they're just there because
-                       ** it's a convenient place to put them!).
-                       */
-                       ReportedModemStatus = RBYTE(PktCmdP->ModemStatus);
-                       if ((PortP->ModemState & MSVR1_HOST) ==
-                                       (ReportedModemStatus & MSVR1_HOST)) {
-                               rio_dprintk (RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
-                               /*
-                               ** Update ModemState just in case tbusy or tstop states have
-                               ** changed.
-                               */
-                               PortP->ModemState = ReportedModemStatus;
-                       }
-                       else {
-                               rio_dprintk (RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n",
-                                    PortP->ModemState, ReportedModemStatus);
-                               PortP->ModemState = ReportedModemStatus;
+                        ** Update ModemState just in case tbusy or tstop states have
+                        ** changed.
+                        */
+                       PortP->ModemState = ReportedModemStatus;
+               } else {
+                       rio_dprintk(RIO_DEBUG_CMD, "Modem status change from 0x%x to 0x%x\n", PortP->ModemState, ReportedModemStatus);
+                       PortP->ModemState = ReportedModemStatus;
 #ifdef MODEM_SUPPORT
-                               if ( PortP->Mapped ) {
+                       if (PortP->Mapped) {
                                /***********************************************************\
                                *************************************************************
                                ***                                                                                                        ***
@@ -525,68 +501,67 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
                                *************************************************************
                                \***********************************************************/
                                /*
-                               ** If the device is a modem, then check the modem
-                               ** carrier.
-                               */
+                                ** If the device is a modem, then check the modem
+                                ** carrier.
+                                */
                                if (PortP->gs.tty == NULL)
                                        break;
                                if (PortP->gs.tty->termios == NULL)
                                        break;
-                         
-                               if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) &&
-                               ((PortP->State & (RIO_MOPEN|RIO_WOPEN)))) {
 
-                                       rio_dprintk (RIO_DEBUG_CMD, "Is there a Carrier?\n");
-                       /*
-                       ** Is there a carrier?
-                       */
-                                       if ( PortP->ModemState & MSVR1_CD ) {
-                       /*
-                       ** Has carrier just appeared?
-                       */
+                               if (!(PortP->gs.tty->termios->c_cflag & CLOCAL) && ((PortP->State & (RIO_MOPEN | RIO_WOPEN)))) {
+
+                                       rio_dprintk(RIO_DEBUG_CMD, "Is there a Carrier?\n");
+                                       /*
+                                        ** Is there a carrier?
+                                        */
+                                       if (PortP->ModemState & MSVR1_CD) {
+                                               /*
+                                                ** Has carrier just appeared?
+                                                */
                                                if (!(PortP->State & RIO_CARR_ON)) {
-                                                       rio_dprintk (RIO_DEBUG_CMD, "Carrier just came up.\n");
+                                                       rio_dprintk(RIO_DEBUG_CMD, "Carrier just came up.\n");
                                                        PortP->State |= RIO_CARR_ON;
-                               /*
-                               ** wakeup anyone in WOPEN
-                               */
-                                                       if (PortP->State & (PORT_ISOPEN | RIO_WOPEN) )
-                                                               wake_up_interruptible (&PortP->gs.open_wait);
+                                                       /*
+                                                        ** wakeup anyone in WOPEN
+                                                        */
+                                                       if (PortP->State & (PORT_ISOPEN | RIO_WOPEN))
+                                                               wake_up_interruptible(&PortP->gs.open_wait);
 #ifdef STATS
-                               PortP->Stat.ModemOnCnt++;
+                                                       PortP->Stat.ModemOnCnt++;
 #endif
-                       }
+                                               }
                                        } else {
-                       /*
-                       ** Has carrier just dropped?
-                       */
+                                               /*
+                                                ** Has carrier just dropped?
+                                                */
                                                if (PortP->State & RIO_CARR_ON) {
-                                                       if (PortP->State & (PORT_ISOPEN|RIO_WOPEN|RIO_MOPEN))
-                                                               tty_hangup (PortP->gs.tty);
+                                                       if (PortP->State & (PORT_ISOPEN | RIO_WOPEN | RIO_MOPEN))
+                                                               tty_hangup(PortP->gs.tty);
                                                        PortP->State &= ~RIO_CARR_ON;
-                                                       rio_dprintk (RIO_DEBUG_CMD, "Carrirer just went down\n");
+                                                       rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n");
 #ifdef STATS
-                               PortP->Stat.ModemOffCnt++;
+                                                       PortP->Stat.ModemOffCnt++;
 #endif
+                                               }
+                                       }
+                               }
                        }
-                       }
-               }
-               }
 #endif
-                       }
-                       break;
+               }
+               break;
 
-               default:
-                       rio_dprintk (RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n",
-                            RBYTE(PktCmdP->Command),HostP-p->RIOHosts);
-                       break;
+       default:
+               rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", RBYTE(PktCmdP->Command), HostP - p->RIOHosts);
+               break;
        }
        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
 
-       func_exit ();
+       func_exit();
 
        return TRUE;
 }
+
 /*
 ** The command mechanism:
 **     Each rup has a chain of commands associated with it.
@@ -600,12 +575,11 @@ RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP)
 /*
 ** Allocate an empty command block.
 */
-struct CmdBlk *
-RIOGetCmdBlk(void)
+struct CmdBlk *RIOGetCmdBlk(void)
 {
        struct CmdBlk *CmdBlkP;
 
-       CmdBlkP = (struct CmdBlk *)sysbrk(sizeof(struct CmdBlk));
+       CmdBlkP = (struct CmdBlk *) sysbrk(sizeof(struct CmdBlk));
        if (CmdBlkP)
                bzero(CmdBlkP, sizeof(struct CmdBlk));
 
@@ -615,31 +589,29 @@ RIOGetCmdBlk(void)
 /*
 ** Return a block to the head of the free list.
 */
-void
-RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
+void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
 {
-       sysfree((void *)CmdBlkP, sizeof(struct CmdBlk));
+       sysfree((void *) CmdBlkP, sizeof(struct CmdBlk));
 }
 
 /*
 ** attach a command block to the list of commands to be performed for
 ** a given rup.
 */
-int
-RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
+int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
 {
        struct CmdBlk **Base;
        struct UnixRup *UnixRupP;
        unsigned long flags;
 
 #ifdef CHECK
-       CheckHostP( HostP );
-       CheckRup( Rup );
-       CheckCmdBlkP( CmdBlkP );
+       CheckHostP(HostP);
+       CheckRup(Rup);
+       CheckCmdBlkP(CmdBlkP);
 #endif
-       if ( Rup >= (ushort)(MAX_RUP+LINKS_PER_UNIT) ) {
-               rio_dprintk (RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n",Rup);
-               RIOFreeCmdBlk( CmdBlkP );
+       if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) {
+               rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup);
+               RIOFreeCmdBlk(CmdBlkP);
                return RIO_FAIL;
        }
 
@@ -648,57 +620,52 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
        rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
 
        /*
-       ** If the RUP is currently inactive, then put the request
-       ** straight on the RUP....
-       */
-       if ( (UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && 
-            (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE ) &&
-               (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg,CmdBlkP)
-                                                       :TRUE)) {
-               rio_dprintk (RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n",
-                                            CmdBlkP->Packet.data[0]);
+        ** If the RUP is currently inactive, then put the request
+        ** straight on the RUP....
+        */
+       if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP)
+                                                                                                                                            : TRUE)) {
+               rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]);
 
                /*
-               ** Whammy! blat that pack!
-               */
-               HostP->Copy( (caddr_t)&CmdBlkP->Packet, 
-                       RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt ), sizeof(PKT) );
+                ** Whammy! blat that pack!
+                */
+               HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
 
                /*
-               ** place command packet on the pending position.
-               */
+                ** place command packet on the pending position.
+                */
                UnixRupP->CmdPendingP = CmdBlkP;
 
                /*
-               ** set the command register
-               */
-               WWORD(UnixRupP->RupP->txcontrol , TX_PACKET_READY);
+                ** set the command register
+                */
+               WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY);
 
                rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
 
                return RIO_SUCCESS;
        }
-       rio_dprintk (RIO_DEBUG_CMD, "RUP active - en-queing\n");
+       rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n");
 
-       if ( UnixRupP->CmdsWaitingP != NULL)
-               rio_dprintk (RIO_DEBUG_CMD, "Rup active - command waiting\n");
-       if ( UnixRupP->CmdPendingP != NULL )
-               rio_dprintk (RIO_DEBUG_CMD, "Rup active - command pending\n");
-       if ( RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE )
-               rio_dprintk (RIO_DEBUG_CMD, "Rup active - command rup not ready\n");
+       if (UnixRupP->CmdsWaitingP != NULL)
+               rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n");
+       if (UnixRupP->CmdPendingP != NULL)
+               rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n");
+       if (RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE)
+               rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n");
 
        Base = &UnixRupP->CmdsWaitingP;
 
-       rio_dprintk (RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int)CmdBlkP,(int)Base);
+       rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base);
 
-       while ( *Base ) {
-               rio_dprintk (RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int)(*Base));
+       while (*Base) {
+               rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int) (*Base));
                Base = &((*Base)->NextP);
-               rio_dprintk (RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n",
-                                            (int)CmdBlkP,(int)Base);
+               rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base);
        }
 
-       rio_dprintk (RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n",(int)CmdBlkP,(int)Base);
+       rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base);
 
        *Base = CmdBlkP;
 
@@ -713,8 +680,7 @@ RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
 ** Here we go - if there is an empty rup, fill it!
 ** must be called at splrio() or higher.
 */
-void
-RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
+void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
 {
        register struct CmdBlk *CmdBlkP;
        register struct UnixRup *UnixRupP;
@@ -723,262 +689,246 @@ RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
        unsigned long flags;
 
 
-       Rup = MAX_RUP+LINKS_PER_UNIT;
+       Rup = MAX_RUP + LINKS_PER_UNIT;
 
-       do {    /* do this loop for each RUP */
+       do {                    /* do this loop for each RUP */
                /*
-               ** locate the rup we are processing & lock it
-               */
+                ** locate the rup we are processing & lock it
+                */
                UnixRupP = &HostP->UnixRups[--Rup];
 
                spin_lock_irqsave(&UnixRupP->RupLock, flags);
 
                /*
-               ** First check for incoming commands:
-               */
-               if ( RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE ) {
+                ** First check for incoming commands:
+                */
+               if (RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) {
                        int FreeMe;
 
-                       PacketP =(PKT *)RIO_PTR(HostP->Caddr,RWORD(UnixRupP->RupP->rxpkt));
+                       PacketP = (PKT *) RIO_PTR(HostP->Caddr, RWORD(UnixRupP->RupP->rxpkt));
 
-                       ShowPacket( DBG_CMD, PacketP );
+                       ShowPacket(DBG_CMD, PacketP);
 
-                       switch ( RBYTE(PacketP->dest_port) ) {
-                               case BOOT_RUP:
-                                       rio_dprintk (RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", 
-                                               RBYTE(PacketP->len) & 0x80 ? "Command":"Data", 
-                                                            RBYTE(PacketP->data[0])); 
-                                       rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
-                                       FreeMe= RIOBootRup(p, Rup,HostP,PacketP);
-                                       rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
-                                       break;
+                       switch (RBYTE(PacketP->dest_port)) {
+                       case BOOT_RUP:
+                               rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command" : "Data", RBYTE(PacketP->data[0]));
+                               rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
+                               FreeMe = RIOBootRup(p, Rup, HostP, PacketP);
+                               rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
+                               break;
 
-                               case COMMAND_RUP:
-                                       /*
-                                       ** Free the RUP lock as loss of carrier causes a
-                                       ** ttyflush which will (eventually) call another
-                                       ** routine that uses the RUP lock.
-                                       */
-                                       rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
-                                       FreeMe= RIOCommandRup(p, Rup,HostP,PacketP);
-                                       if (PacketP->data[5] == MEMDUMP) {
-                                               rio_dprintk (RIO_DEBUG_CMD, "Memdump from 0x%x complete\n",
-                                                                    *(ushort *) &(PacketP->data[6]));
-                                               HostP->Copy( (caddr_t)&(PacketP->data[8]), 
-                                                               (caddr_t)p->RIOMemDump, 32 );
-                                       }
-                                       rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
-                                       break;
+                       case COMMAND_RUP:
+                               /*
+                                ** Free the RUP lock as loss of carrier causes a
+                                ** ttyflush which will (eventually) call another
+                                ** routine that uses the RUP lock.
+                                */
+                               rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
+                               FreeMe = RIOCommandRup(p, Rup, HostP, PacketP);
+                               if (PacketP->data[5] == MEMDUMP) {
+                                       rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(ushort *) & (PacketP->data[6]));
+                                       HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32);
+                               }
+                               rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
+                               break;
 
-                               case ROUTE_RUP:
-                                       rio_spin_unlock_irqrestore( &UnixRupP->RupLock, flags);
-                                       FreeMe = RIORouteRup(p, Rup, HostP, PacketP );
-                                       rio_spin_lock_irqsave( &UnixRupP->RupLock, flags );
-                                       break;
+                       case ROUTE_RUP:
+                               rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
+                               FreeMe = RIORouteRup(p, Rup, HostP, PacketP);
+                               rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
+                               break;
 
-                               default:
-                                       rio_dprintk (RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port));
-                                       FreeMe = 1;
-                                       break;
+                       default:
+                               rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port));
+                               FreeMe = 1;
+                               break;
                        }
 
-                       if ( FreeMe ) {
-                               rio_dprintk (RIO_DEBUG_CMD, "Free processed incoming command packet\n");
-                               put_free_end(HostP,PacketP);
+                       if (FreeMe) {
+                               rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n");
+                               put_free_end(HostP, PacketP);
 
-                               WWORD(UnixRupP->RupP->rxcontrol , RX_RUP_INACTIVE);
+                               WWORD(UnixRupP->RupP->rxcontrol, RX_RUP_INACTIVE);
 
-                               if ( RWORD(UnixRupP->RupP->handshake)==PHB_HANDSHAKE_SET ) {
-                                       rio_dprintk (RIO_DEBUG_CMD, "Handshake rup %d\n",Rup);
-                                       WWORD(UnixRupP->RupP->handshake,
-                                               PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET);
+                               if (RWORD(UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) {
+                                       rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup);
+                                       WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
                                }
                        }
                }
 
                /*
-               ** IF a command was running on the port, 
-               ** and it has completed, then tidy it up.
-               */
-               if ( (CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */
-                    (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
+                ** IF a command was running on the port,
+                ** and it has completed, then tidy it up.
+                */
+               if ((CmdBlkP = UnixRupP->CmdPendingP) &&        /* ASSIGN! */
+                   (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
                        /*
-                       ** we are idle.
-                       ** there is a command in pending.
-                       ** Therefore, this command has finished.
-                       ** So, wakeup whoever is waiting for it (and tell them
-                       ** what happened).
-                       */
-                       if ( CmdBlkP->Packet.dest_port == BOOT_RUP )
-                               rio_dprintk (RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", 
-                                               CmdBlkP->Packet.len & 0x80 ? "Command":"Data", 
-                                                            CmdBlkP->Packet.data[0]);
-
-                       rio_dprintk (RIO_DEBUG_CMD, "Command 0x%x completed\n",(int)CmdBlkP);
+                        ** we are idle.
+                        ** there is a command in pending.
+                        ** Therefore, this command has finished.
+                        ** So, wakeup whoever is waiting for it (and tell them
+                        ** what happened).
+                        */
+                       if (CmdBlkP->Packet.dest_port == BOOT_RUP)
+                               rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]);
+
+                       rio_dprintk(RIO_DEBUG_CMD, "Command 0x%x completed\n", (int) CmdBlkP);
 
                        /*
-                       ** Clear the Rup lock to prevent mutual exclusion.
-                       */
-                       if ( CmdBlkP->PostFuncP ) {
+                        ** Clear the Rup lock to prevent mutual exclusion.
+                        */
+                       if (CmdBlkP->PostFuncP) {
                                rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
-                               (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg,CmdBlkP);
+                               (*CmdBlkP->PostFuncP) (CmdBlkP->PostArg, CmdBlkP);
                                rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
                        }
 
                        /*
-                       ** ....clear the pending flag....
-                       */
+                        ** ....clear the pending flag....
+                        */
                        UnixRupP->CmdPendingP = NULL;
 
                        /*
-                       ** ....and return the command block to the freelist.
-                       */
-                       RIOFreeCmdBlk( CmdBlkP );
+                        ** ....and return the command block to the freelist.
+                        */
+                       RIOFreeCmdBlk(CmdBlkP);
                }
 
                /*
-               ** If there is a command for this rup, and the rup
-               ** is idle, then process the command
-               */
-               if ( (CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */
-                       (UnixRupP->CmdPendingP == NULL) &&
-                    (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
+                ** If there is a command for this rup, and the rup
+                ** is idle, then process the command
+                */
+               if ((CmdBlkP = UnixRupP->CmdsWaitingP) &&       /* ASSIGN! */
+                   (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
                        /*
-                       ** if the pre-function is non-zero, call it.
-                       ** If it returns RIO_FAIL then don't
-                       ** send this command yet!
-                       */
+                        ** if the pre-function is non-zero, call it.
+                        ** If it returns RIO_FAIL then don't
+                        ** send this command yet!
+                        */
 #ifdef CHECK
-                       CheckCmdBlkP (CmdBlkP);
+                       CheckCmdBlkP(CmdBlkP);
 #endif
-                       if ( !(CmdBlkP->PreFuncP ?
-                               (*CmdBlkP->PreFuncP)(CmdBlkP->PreArg, CmdBlkP) : TRUE)) {
-                               rio_dprintk (RIO_DEBUG_CMD, "Not ready to start command 0x%x\n",(int)CmdBlkP);
-                       }
-                       else {
-                               rio_dprintk (RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n",
-                                                            (int)CmdBlkP, CmdBlkP->Packet.data[0]);
+                       if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) {
+                               rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP);
+                       } else {
+                               rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", (int) CmdBlkP, CmdBlkP->Packet.data[0]);
                                /*
-                               ** Whammy! blat that pack!
-                               */
+                                ** Whammy! blat that pack!
+                                */
 #ifdef CHECK
-                               CheckPacketP ((PKT *)RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt));
+                               CheckPacketP((PKT *) RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt));
 #endif
-                               HostP->Copy( (caddr_t)&CmdBlkP->Packet, 
-                                       RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
+                               HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT));
 
                                /*
-                               ** remove the command from the rup command queue...
-                               */
+                                ** remove the command from the rup command queue...
+                                */
                                UnixRupP->CmdsWaitingP = CmdBlkP->NextP;
 
                                /*
-                               ** ...and place it on the pending position.
-                               */
+                                ** ...and place it on the pending position.
+                                */
                                UnixRupP->CmdPendingP = CmdBlkP;
 
                                /*
-                               ** set the command register
-                               */
-                               WWORD(UnixRupP->RupP->txcontrol,TX_PACKET_READY);
+                                ** set the command register
+                                */
+                               WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY);
 
                                /*
-                               ** the command block will be freed
-                               ** when the command has been processed.
-                               */
+                                ** the command block will be freed
+                                ** when the command has been processed.
+                                */
                        }
                }
                spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
-       } while ( Rup );
+       } while (Rup);
 }
 
-int
-RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
+int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP)
 {
-       struct Port *   PortP = (struct Port *)iPortP;
+       struct Port *PortP = (struct Port *) iPortP;
        unsigned long flags;
 
        rio_spin_lock_irqsave(&PortP->portSem, flags);
 #ifdef CHECK
-       CheckPortP( PortP );
+       CheckPortP(PortP);
 #endif
        PortP->WflushFlag++;
        PortP->MagicFlags |= MAGIC_FLUSH;
        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-       return RIOUnUse( iPortP, CmdBlkP );
+       return RIOUnUse(iPortP, CmdBlkP);
 }
 
-int
-RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
+int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP)
 {
-       struct Port *   PortP = (struct Port *)iPortP;
+       struct Port *PortP = (struct Port *) iPortP;
        PKT *PacketP;
        unsigned long flags;
 
        rio_spin_lock_irqsave(&PortP->portSem, flags);
 
-       while ( can_remove_receive(&PacketP, PortP) ) {
+       while (can_remove_receive(&PacketP, PortP)) {
                remove_receive(PortP);
-               ShowPacket(DBG_PROC, PacketP );
-               put_free_end( PortP->HostP, PacketP );
+               ShowPacket(DBG_PROC, PacketP);
+               put_free_end(PortP->HostP, PacketP);
        }
 
-       if ( RWORD(PortP->PhbP->handshake)==PHB_HANDSHAKE_SET ) {
+       if (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) {
                /*
-               ** MAGIC! (Basically, handshake the RX buffer, so that
-               ** the RTAs upstream can be re-enabled.)
-               */
-               rio_dprintk (RIO_DEBUG_CMD, "Util: Set RX handshake bit\n");
-               WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET);
+                ** MAGIC! (Basically, handshake the RX buffer, so that
+                ** the RTAs upstream can be re-enabled.)
+                */
+               rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n");
+               WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
        }
        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-       return RIOUnUse( iPortP, CmdBlkP );
+       return RIOUnUse(iPortP, CmdBlkP);
 }
 
-int
-RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
+int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP)
 {
-       struct Port *   PortP = (struct Port *)iPortP;
+       struct Port *PortP = (struct Port *) iPortP;
        unsigned long flags;
 
        rio_spin_lock_irqsave(&PortP->portSem, flags);
 
 #ifdef CHECK
-       CheckPortP( PortP );
+       CheckPortP(PortP);
 #endif
-       rio_dprintk (RIO_DEBUG_CMD, "Decrement in use count for port\n");
+       rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n");
 
        if (PortP->InUse) {
-               if ( --PortP->InUse != NOT_INUSE ) {
+               if (--PortP->InUse != NOT_INUSE) {
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                        return 0;
                }
        }
        /*
-       ** While PortP->InUse is set (i.e. a preemptive command has been sent to
-       ** the RTA and is awaiting completion), any transmit data is prevented from
-       ** being transferred from the write queue into the transmit packets
-       ** (add_transmit) and no furthur transmit interrupt will be sent for that
-       ** data. The next interrupt will occur up to 500ms later (RIOIntr is called
-       ** twice a second as a saftey measure). This was the case when kermit was
-       ** used to send data into a RIO port. After each packet was sent, TCFLSH
-       ** was called to flush the read queue preemptively. PortP->InUse was
-       ** incremented, thereby blocking the 6 byte acknowledgement packet
-       ** transmitted back. This acknowledgment hung around for 500ms before
-       ** being sent, thus reducing input performance substantially!.
-       ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data
-       ** hanging around in the transmit buffer is sent immediately.
-       */
+        ** While PortP->InUse is set (i.e. a preemptive command has been sent to
+        ** the RTA and is awaiting completion), any transmit data is prevented from
+        ** being transferred from the write queue into the transmit packets
+        ** (add_transmit) and no furthur transmit interrupt will be sent for that
+        ** data. The next interrupt will occur up to 500ms later (RIOIntr is called
+        ** twice a second as a saftey measure). This was the case when kermit was
+        ** used to send data into a RIO port. After each packet was sent, TCFLSH
+        ** was called to flush the read queue preemptively. PortP->InUse was
+        ** incremented, thereby blocking the 6 byte acknowledgement packet
+        ** transmitted back. This acknowledgment hung around for 500ms before
+        ** being sent, thus reducing input performance substantially!.
+        ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data
+        ** hanging around in the transmit buffer is sent immediately.
+        */
        WWORD(PortP->HostP->ParmMapP->tx_intr, 1);
        /* What to do here ..
-       wakeup( (caddr_t)&(PortP->InUse) );
-       */
+          wakeup( (caddr_t)&(PortP->InUse) );
+        */
        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
        return 0;
 }
 
-void
-ShowPacket(uint Flags, struct PKT *PacketP)
+void ShowPacket(uint Flags, struct PKT *PacketP)
 {
 }
 
index b4d1a23e27e454304941f0794c9e3c5f1604b6c0..0b7700d2f0495fa513a915c26c69bdbbd09c43a5 100644 (file)
@@ -82,16 +82,16 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c      1.3";
 #include "rioioctl.h"
 
 
-static struct LpbReq    LpbReq;
-static struct RupReq    RupReq;
-static struct PortReq  PortReq;
-static struct HostReq  HostReq;
+static struct LpbReq LpbReq;
+static struct RupReq RupReq;
+static struct PortReq PortReq;
+static struct HostReq HostReq;
 static struct HostDpRam HostDpRam;
 static struct DebugCtrl DebugCtrl;
-static struct Map               MapEnt;
+static struct Map MapEnt;
 static struct PortSetup PortSetup;
-static struct DownLoad DownLoad;
-static struct SendPack  SendPack;
+static struct DownLoad DownLoad;
+static struct SendPack SendPack;
 /* static struct StreamInfo    StreamInfo; */
 /* static char modemtable[RIO_PORTS]; */
 static struct SpecialRupCmd SpecialRupCmd;
@@ -99,18 +99,18 @@ static struct PortParams PortParams;
 static struct portStats portStats;
 
 static struct SubCmdStruct {
-       ushort  Host;
-       ushort  Rup;
-       ushort  Port;
-       ushort  Addr;
+       ushort Host;
+       ushort Rup;
+       ushort Port;
+       ushort Addr;
 } SubCmd;
 
 struct PortTty {
-       uint            port;
-       struct ttystatics       Tty;
+       uint port;
+       struct ttystatics Tty;
 };
 
-static struct PortTty  PortTty;
+static struct PortTty PortTty;
 typedef struct ttystatics TERMIO;
 
 /*
@@ -121,267 +121,264 @@ typedef struct ttystatics TERMIO;
 ** The RIOBootCodeUNKNOWN entry is there to politely tell the calling
 ** process to bog off.
 */
-static int 
-(*RIOBootTable[MAX_PRODUCT])(struct rio_info *, struct DownLoad *) =
-{
-/* 0 */        RIOBootCodeHOST,        /* Host Card */
-/* 1 */        RIOBootCodeRTA,         /* RTA */
+static int
+ (*RIOBootTable[MAX_PRODUCT]) (struct rio_info *, struct DownLoad *) = {
+                                       /* 0 */ RIOBootCodeHOST,
+                                       /* Host Card */
+                                       /* 1 */ RIOBootCodeRTA,
+                                       /* RTA */
 };
 
 #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))
 
-int copyin (int arg, caddr_t dp, int siz)
+int copyin(int arg, caddr_t dp, int siz)
 {
-  int rv;
+       int rv;
 
-  rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *)arg, dp);
-  rv = copy_from_user (dp, (void *)arg, siz);
-  if (rv) return COPYFAIL;
-  else return rv;
+       rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *) arg, dp);
+       rv = copy_from_user(dp, (void *) arg, siz);
+       if (rv)
+               return COPYFAIL;
+       else
+               return rv;
 }
 
-static int copyout (caddr_t dp, int arg, int siz)
+static int copyout(caddr_t dp, int arg, int siz)
 {
-  int rv;
+       int rv;
 
-  rio_dprintk (RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *)arg, dp);
-  rv = copy_to_user ((void *)arg, dp, siz);
-  if (rv) return COPYFAIL;
-  else return rv;
+       rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *) arg, dp);
+       rv = copy_to_user((void *) arg, dp, siz);
+       if (rv)
+               return COPYFAIL;
+       else
+               return rv;
 }
 
-int
-riocontrol(p, dev, cmd, arg, su)
-struct rio_info        * p;
-dev_t          dev;
-int            cmd;
-caddr_t                arg;
-int            su;
+int riocontrol(p, dev, cmd, arg, su)
+struct rio_info *p;
+dev_t dev;
+int cmd;
+caddr_t arg;
+int su;
 {
-       uint    Host;   /* leave me unsigned! */
-       uint    port;   /* and me! */
-       struct Host     *HostP;
-       ushort  loop;
-       int             Entry;
-       struct Port     *PortP;
-       PKT     *PacketP;
-       int             retval = 0;
+       uint Host;              /* leave me unsigned! */
+       uint port;              /* and me! */
+       struct Host *HostP;
+       ushort loop;
+       int Entry;
+       struct Port *PortP;
+       PKT *PacketP;
+       int retval = 0;
        unsigned long flags;
-       
-       func_enter ();
-       
+
+       func_enter();
+
        /* Confuse the compiler to think that we've initialized these */
-       Host=0;
+       Host = 0;
        PortP = NULL;
 
-       rio_dprintk (RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int)arg);
+       rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int) arg);
 
        switch (cmd) {
                /*
-               ** RIO_SET_TIMER
-               **
-               ** Change the value of the host card interrupt timer.
-               ** If the host card number is -1 then all host cards are changed
-               ** otherwise just the specified host card will be changed.
-               */
-               case RIO_SET_TIMER:
-                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint)arg);
-                       {
-                               int host, value;
-                               host = (uint)arg >> 16;
-                               value = (uint)arg & 0x0000ffff;
-                               if (host == -1) {
-                                       for (host = 0; host < p->RIONumHosts; host++) {
-                                               if (p->RIOHosts[host].Flags == RC_RUNNING) {
-                                                       WWORD(p->RIOHosts[host].ParmMapP->timer , value);
-                                               }
-                                       }
-                               } else if (host >= p->RIONumHosts) {
-                                       return -EINVAL;
-                               } else {
-                                       if ( p->RIOHosts[host].Flags == RC_RUNNING ) {
-                                               WWORD(p->RIOHosts[host].ParmMapP->timer , value);
+                ** RIO_SET_TIMER
+                **
+                ** Change the value of the host card interrupt timer.
+                ** If the host card number is -1 then all host cards are changed
+                ** otherwise just the specified host card will be changed.
+                */
+       case RIO_SET_TIMER:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint) arg);
+               {
+                       int host, value;
+                       host = (uint) arg >> 16;
+                       value = (uint) arg & 0x0000ffff;
+                       if (host == -1) {
+                               for (host = 0; host < p->RIONumHosts; host++) {
+                                       if (p->RIOHosts[host].Flags == RC_RUNNING) {
+                                               WWORD(p->RIOHosts[host].ParmMapP->timer, value);
                                        }
                                }
-                       }
-                       return 0;
-
-               case RIO_IDENTIFY_DRIVER:
-                       /*
-                       ** 15.10.1998 ARG - ESIL 0760 part fix
-                       ** Added driver ident string output.
-                       **
-#ifndef __THIS_RELEASE__
-#warning Driver Version string not defined !
-#endif
-                       cprintf("%s %s %s %s\n",
-                               RIO_DRV_STR,
-                               __THIS_RELEASE__,
-                               __DATE__, __TIME__ );
-
-                       return 0;
-
-               case RIO_DISPLAY_HOST_CFG:
-                       **
-                       ** 15.10.1998 ARG - ESIL 0760 part fix
-                       ** Added driver host card ident string output.
-                       **
-                       ** Note that the only types currently supported
-                       ** are ISA and PCI. Also this driver does not
-                       ** (yet) distinguish between the Old PCI card
-                       ** and the Jet PCI card. In fact I think this
-                       ** driver only supports JET PCI !
-                       **
-
-                       for (Host = 0; Host < p->RIONumHosts; Host++)
-                       {
-                               HostP = &(p->RIOHosts[Host]);
-
-                               switch ( HostP->Type )
-                               {
-                                   case RIO_AT :
-                                       strcpy( host_type, RIO_AT_HOST_STR );
-                                       break;
-
-                                   case RIO_PCI :
-                                       strcpy( host_type, RIO_PCI_HOST_STR );
-                                       break;
-
-                                   default :
-                                       strcpy( host_type, "Unknown" );
-                                       break;
+                       } else if (host >= p->RIONumHosts) {
+                               return -EINVAL;
+                       } else {
+                               if (p->RIOHosts[host].Flags == RC_RUNNING) {
+                                       WWORD(p->RIOHosts[host].ParmMapP->timer, value);
                                }
+                       }
+               }
+               return 0;
 
-                               cprintf(
-                                 "RIO Host %d - Type:%s Addr:%X IRQ:%d\n",
-                                       Host, host_type,
-                                       (uint)HostP->PaddrP,
-                                       (int)HostP->Ivec - 32  );
+       case RIO_IDENTIFY_DRIVER:
+               /*
+                ** 15.10.1998 ARG - ESIL 0760 part fix
+                ** Added driver ident string output.
+                **
+                #ifndef __THIS_RELEASE__
+                #warning Driver Version string not defined !
+                #endif
+                cprintf("%s %s %s %s\n",
+                RIO_DRV_STR,
+                __THIS_RELEASE__,
+                __DATE__, __TIME__ );
+
+                return 0;
+
+                case RIO_DISPLAY_HOST_CFG:
+                **
+                ** 15.10.1998 ARG - ESIL 0760 part fix
+                ** Added driver host card ident string output.
+                **
+                ** Note that the only types currently supported
+                ** are ISA and PCI. Also this driver does not
+                ** (yet) distinguish between the Old PCI card
+                ** and the Jet PCI card. In fact I think this
+                ** driver only supports JET PCI !
+                **
+
+                for (Host = 0; Host < p->RIONumHosts; Host++)
+                {
+                HostP = &(p->RIOHosts[Host]);
+
+                switch ( HostP->Type )
+                {
+                case RIO_AT :
+                strcpy( host_type, RIO_AT_HOST_STR );
+                break;
+
+                case RIO_PCI :
+                strcpy( host_type, RIO_PCI_HOST_STR );
+                break;
+
+                default :
+                strcpy( host_type, "Unknown" );
+                break;
+                }
+
+                cprintf(
+                "RIO Host %d - Type:%s Addr:%X IRQ:%d\n",
+                Host, host_type,
+                (uint)HostP->PaddrP,
+                (int)HostP->Ivec - 32  );
+                }
+                return 0;
+                **
+                */
+
+       case RIO_FOAD_RTA:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n");
+               return RIOCommandRta(p, (uint) arg, RIOFoadRta);
+
+       case RIO_ZOMBIE_RTA:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n");
+               return RIOCommandRta(p, (uint) arg, RIOZombieRta);
+
+       case RIO_IDENTIFY_RTA:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n");
+               return RIOIdentifyRta(p, arg);
+
+       case RIO_KILL_NEIGHBOUR:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n");
+               return RIOKillNeighbour(p, arg);
+
+       case SPECIAL_RUP_CMD:
+               {
+                       struct CmdBlk *CmdBlkP;
+
+                       rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n");
+                       if (copyin((int) arg, (caddr_t) & SpecialRupCmd, sizeof(SpecialRupCmd)) == COPYFAIL) {
+                               rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
+                               p->RIOError.Error = COPYIN_FAILED;
+                               return -EFAULT;
+                       }
+                       CmdBlkP = RIOGetCmdBlk();
+                       if (!CmdBlkP) {
+                               rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n");
+                               return -ENXIO;
+                       }
+                       CmdBlkP->Packet = SpecialRupCmd.Packet;
+                       if (SpecialRupCmd.Host >= p->RIONumHosts)
+                               SpecialRupCmd.Host = 0;
+                       rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum);
+                       if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
+                               cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n");
                        }
                        return 0;
-                       **
-                       */
-
-               case RIO_FOAD_RTA:
-                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n");
-                       return RIOCommandRta(p, (uint)arg, RIOFoadRta);
-
-               case RIO_ZOMBIE_RTA:
-                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n");
-                       return RIOCommandRta(p, (uint)arg, RIOZombieRta);
-
-               case RIO_IDENTIFY_RTA:
-                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n");
-                       return RIOIdentifyRta(p, arg);
-
-               case RIO_KILL_NEIGHBOUR:
-                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n");
-                       return RIOKillNeighbour(p, arg);
-
-               case SPECIAL_RUP_CMD:
-                       {
-                               struct CmdBlk *CmdBlkP;
-
-                               rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n");
-                               if (copyin((int)arg, (caddr_t)&SpecialRupCmd, 
-                                                       sizeof(SpecialRupCmd)) == COPYFAIL ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
-                               CmdBlkP = RIOGetCmdBlk();
-                               if ( !CmdBlkP ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n");
-                                       return -ENXIO;
-                               }
-                               CmdBlkP->Packet = SpecialRupCmd.Packet;
-                               if ( SpecialRupCmd.Host >= p->RIONumHosts )
-                                       SpecialRupCmd.Host = 0;
-                                       rio_dprintk (RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n",
-                                               SpecialRupCmd.Host, SpecialRupCmd.RupNum);
-                                       if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], 
-                                                       SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
-                                               cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n");
-                                       }
-                                       return 0;
-                               }
+               }
 
-                       case RIO_DEBUG_MEM:
+       case RIO_DEBUG_MEM:
 #ifdef DEBUG_MEM_SUPPORT
-RIO_DEBUG_CTRL,                                if (su)
-                                       return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg);
-                               else
+               RIO_DEBUG_CTRL, if (su)
+                       return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg);
+               else
 #endif
-                                       return -EPERM;
-
-                       case RIO_ALL_MODEM:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n");
-                               p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
-                               return -EINVAL;
-
-                       case RIO_GET_TABLE:
-                               /*
-                               ** Read the routing table from the device driver to user space
-                               */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE\n");
+                       return -EPERM;
 
-                               if ((retval = RIOApel(p)) != 0)
-                                       return retval;
+       case RIO_ALL_MODEM:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n");
+               p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
+               return -EINVAL;
 
-                               if (copyout((caddr_t)p->RIOConnectTable, (int)arg,
-                                               TOTAL_MAP_ENTRIES*sizeof(struct Map)) == COPYFAIL) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       return -EFAULT;
-                               }
+       case RIO_GET_TABLE:
+               /*
+                ** Read the routing table from the device driver to user space
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE\n");
+
+               if ((retval = RIOApel(p)) != 0)
+                       return retval;
+
+               if (copyout((caddr_t) p->RIOConnectTable, (int) arg, TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+
+               {
+                       int entry;
+                       rio_dprintk(RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n");
+                       for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
+                               if ((p->RIOConnectTable[entry].ID == 0) && (p->RIOConnectTable[entry].HostUniqueNum == 0) && (p->RIOConnectTable[entry].RtaUniqueNum == 0))
+                                       continue;
+
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int) p->RIOConnectTable[entry].Flags);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int) p->RIOConnectTable[entry].SysPort);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name);
+                       }
+                       rio_dprintk(RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n");
+               }
+               p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */
+               return 0;
 
-                               {
-                                       int entry;
-                                       rio_dprintk (RIO_DEBUG_CTRL,  "*****\nMAP ENTRIES\n");
-                                       for ( entry=0; entry<TOTAL_MAP_ENTRIES; entry++ )
-                                       {
-                                         if ((p->RIOConnectTable[entry].ID == 0) &&
-                                             (p->RIOConnectTable[entry].HostUniqueNum == 0) &&
-                                             (p->RIOConnectTable[entry].RtaUniqueNum == 0)) continue;
-                                             
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2 );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int)p->RIOConnectTable[entry].Flags );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int)p->RIOConnectTable[entry].SysPort );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link );
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name );
-                                       }
-                                       rio_dprintk (RIO_DEBUG_CTRL,  "*****\nEND MAP ENTRIES\n");
-                               }
-                               p->RIOQuickCheck = NOT_CHANGED; /* a table has been gotten */
-                               return 0;
-
-                       case RIO_PUT_TABLE:
-                               /*
-                               ** Write the routing table to the device driver from user space
-                               */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n");
-
-                               if ( !su ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n");
-                                       p->RIOError.Error = NOT_SUPER_USER;
-                                       return -EPERM;
-                               }
-                               if ( copyin((int)arg, (caddr_t)&p->RIOConnectTable[0], 
-                                       TOTAL_MAP_ENTRIES*sizeof(struct Map) ) == COPYFAIL ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
+       case RIO_PUT_TABLE:
+               /*
+                ** Write the routing table to the device driver from user space
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n");
+
+               if (!su) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n");
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               if (copyin((int) arg, (caddr_t) & p->RIOConnectTable[0], TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
 /*
 ***********************************
                                {
@@ -409,1353 +406,1244 @@ RIO_DEBUG_CTRL,                               if (su)
                                }
 ***********************************
 */
-                               return RIONewTable(p);
-
-                       case RIO_GET_BINDINGS :
-                               /*
-                               ** Send bindings table, containing unique numbers of RTAs owned
-                               ** by this system to user space
-                               */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n");
+               return RIONewTable(p);
 
-                               if ( !su )
-                               {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n");
-                                       p->RIOError.Error = NOT_SUPER_USER;
-                                       return -EPERM;
-                               }
-                               if (copyout((caddr_t) p->RIOBindTab, (int)arg, 
-                                               (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       return -EFAULT;
-                               }
-                               return 0;
-
-                       case RIO_PUT_BINDINGS :
+       case RIO_GET_BINDINGS:
+               /*
+                ** Send bindings table, containing unique numbers of RTAs owned
+                ** by this system to user space
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n");
+
+               if (!su) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n");
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               if (copyout((caddr_t) p->RIOBindTab, (int) arg, (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return 0;
+
+       case RIO_PUT_BINDINGS:
+               /*
+                ** Receive a bindings table, containing unique numbers of RTAs owned
+                ** by this system
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n");
+
+               if (!su) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n");
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               if (copyin((int) arg, (caddr_t) & p->RIOBindTab[0], (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               return 0;
+
+       case RIO_BIND_RTA:
+               {
+                       int EmptySlot = -1;
                        /*
-                       ** Receive a bindings table, containing unique numbers of RTAs owned
-                       ** by this system
-                       */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n");
-
-                               if ( !su )
-                               {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n");
-                                       p->RIOError.Error = NOT_SUPER_USER;
-                                       return -EPERM;
-                               }
-                               if (copyin((int)arg, (caddr_t)&p->RIOBindTab[0], 
-                                               (sizeof(ulong) * MAX_RTA_BINDINGS))==COPYFAIL ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
-                               return 0;
-
-                       case RIO_BIND_RTA :
-                               {
-                                       int     EmptySlot = -1;
-                                       /*
-                                       ** Bind this RTA to host, so that it will be booted by 
-                                       ** host in 'boot owned RTAs' mode.
-                                       */
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA\n");
-
-                                       if ( !su ) {
-                                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n");
-                                               p->RIOError.Error = NOT_SUPER_USER;
-                                               return -EPERM;
-                                       }
-                                       for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) {
-                                               if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L))
-                                                       EmptySlot = Entry;
-                                               else if (p->RIOBindTab[Entry] == (int) arg) {
-                                                       /*
-                                                       ** Already exists - delete
-                                                       */
-                                                       p->RIOBindTab[Entry] = 0L;
-                                                       rio_dprintk (RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n",
-                                                                                                               (int) arg);
-                                                       return 0;
-                                               }
-                                       }
+                        ** Bind this RTA to host, so that it will be booted by
+                        ** host in 'boot owned RTAs' mode.
+                        */
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA\n");
+
+                       if (!su) {
+                               rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n");
+                               p->RIOError.Error = NOT_SUPER_USER;
+                               return -EPERM;
+                       }
+                       for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) {
+                               if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L))
+                                       EmptySlot = Entry;
+                               else if (p->RIOBindTab[Entry] == (int) arg) {
                                        /*
-                                       ** Dosen't exist - add
-                                       */
-                                       if (EmptySlot != -1) {
-                                               p->RIOBindTab[EmptySlot] = (int) arg;
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n",
-                                                       (int) arg);
-                                       }
-                                       else {
-                                               rio_dprintk (RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n",
-                                                       (int) arg);
-                                               return -ENOMEM;
-                                       }
+                                        ** Already exists - delete
+                                        */
+                                       p->RIOBindTab[Entry] = 0L;
+                                       rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", (int) arg);
                                        return 0;
                                }
-
-                       case RIO_RESUME :
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME\n");
-                               port = (uint) arg;
-                               if ((port < 0) || (port > 511)) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port);
-                                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                       return -EINVAL;
-                               }
-                               PortP = p->RIOPortp[port];
-                               if (!PortP->Mapped) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port);
-                                       p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
-                                       return -EINVAL;
-                               }
-                               if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port);
-                                       return -EINVAL;
-                               }
-
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-                               if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == 
-                                                                               RIO_FAIL) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME failed\n");
-                                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                                       return -EBUSY;
-                               }
-                               else {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port);
-                                       PortP->State |= RIO_BUSY;
-                               }
-                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                               return retval;
-
-                       case RIO_ASSIGN_RTA:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n");
-                               if ( !su ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n");
-                                       p->RIOError.Error = NOT_SUPER_USER;
-                                       return -EPERM;
-                               }
-                               if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt))
-                                                                       == COPYFAIL) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n");
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
-                               return RIOAssignRta(p, &MapEnt);
-
-                       case RIO_CHANGE_NAME:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n");
-                               if ( !su ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n");
-                                       p->RIOError.Error = NOT_SUPER_USER;
-                                       return -EPERM;
-                               }
-                               if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt))
-                                               == COPYFAIL) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n");
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
-                               return RIOChangeName(p, &MapEnt);
-
-                       case RIO_DELETE_RTA:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n");
-                               if ( !su ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n");
-                                       p->RIOError.Error = NOT_SUPER_USER;
-                                       return -EPERM;
-                               }
-                               if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt))
-                                                       == COPYFAIL ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "Copy from data space failed\n");
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
-                               return RIODeleteRta(p, &MapEnt);
-
-                       case RIO_QUICK_CHECK:
-                               /*
-                               ** 09.12.1998 ARG - ESIL 0776 part fix
-                               ** A customer was using this to get the RTAs
-                               ** connect/disconnect status.
-                               ** RIOConCon() had been botched use RIOHalted
-                               ** to keep track of RTA connections and
-                               ** disconnections. That has been changed and
-                               ** RIORtaDisCons in the rio_info struct now
-                               ** does the job. So we need to return the value
-                               ** of RIORtaCons instead of RIOHalted.
-                               **
-                               if (copyout((caddr_t)&p->RIOHalted,(int)arg,
-                                                       sizeof(uint))==COPYFAIL) {
-                               **
-                               */
-
-                               if (copyout((caddr_t)&p->RIORtaDisCons,(int)arg,
-                                                       sizeof(uint))==COPYFAIL) {
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       return -EFAULT;
-                               }
-                               return 0;
-
-                       case RIO_LAST_ERROR:
-                               if (copyout((caddr_t)&p->RIOError, (int)arg, 
-                                               sizeof(struct Error)) ==COPYFAIL )
-                                       return -EFAULT;
-                               return 0;
-
-                       case RIO_GET_LOG:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_LOG\n");
+                       }
+                       /*
+                        ** Dosen't exist - add
+                        */
+                       if (EmptySlot != -1) {
+                               p->RIOBindTab[EmptySlot] = (int) arg;
+                               rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", (int) arg);
+                       } else {
+                               rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", (int) arg);
+                               return -ENOMEM;
+                       }
+                       return 0;
+               }
+
+       case RIO_RESUME:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n");
+               port = (uint) arg;
+               if ((port < 0) || (port > 511)) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port);
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+               PortP = p->RIOPortp[port];
+               if (!PortP->Mapped) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port);
+                       p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
+                       return -EINVAL;
+               }
+               if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port);
+                       return -EINVAL;
+               }
+
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+               if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == RIO_FAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME failed\n");
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                       return -EBUSY;
+               } else {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port);
+                       PortP->State |= RIO_BUSY;
+               }
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return retval;
+
+       case RIO_ASSIGN_RTA:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n");
+               if (!su) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n");
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt))
+                   == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               return RIOAssignRta(p, &MapEnt);
+
+       case RIO_CHANGE_NAME:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n");
+               if (!su) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n");
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt))
+                   == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               return RIOChangeName(p, &MapEnt);
+
+       case RIO_DELETE_RTA:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n");
+               if (!su) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n");
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt))
+                   == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               return RIODeleteRta(p, &MapEnt);
+
+       case RIO_QUICK_CHECK:
+               /*
+                ** 09.12.1998 ARG - ESIL 0776 part fix
+                ** A customer was using this to get the RTAs
+                ** connect/disconnect status.
+                ** RIOConCon() had been botched use RIOHalted
+                ** to keep track of RTA connections and
+                ** disconnections. That has been changed and
+                ** RIORtaDisCons in the rio_info struct now
+                ** does the job. So we need to return the value
+                ** of RIORtaCons instead of RIOHalted.
+                **
+                if (copyout((caddr_t)&p->RIOHalted,(int)arg,
+                sizeof(uint))==COPYFAIL) {
+                **
+                */
+
+               if (copyout((caddr_t) & p->RIORtaDisCons, (int) arg, sizeof(uint)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return 0;
+
+       case RIO_LAST_ERROR:
+               if (copyout((caddr_t) & p->RIOError, (int) arg, sizeof(struct Error)) == COPYFAIL)
+                       return -EFAULT;
+               return 0;
+
+       case RIO_GET_LOG:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n");
 #ifdef LOGGING
-                               RIOGetLog(arg);
-                               return 0;
+               RIOGetLog(arg);
+               return 0;
 #else
-                               return -EINVAL;
+               return -EINVAL;
 #endif
 
-                       case RIO_GET_MODTYPE:
-                               if ( copyin( (int)arg, (caddr_t)&port, 
-                                                                       sizeof(uint)) == COPYFAIL )
-                               {
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "Get module type for port %d\n", port);
-                               if ( port < 0 || port > 511 )
-                               {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port);
-                                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                       return -EINVAL;
-                               }
-                               PortP = (p->RIOPortp[port]);
-                               if (!PortP->Mapped)
-                               {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port);
-                                       p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
-                                       return -EINVAL;
-                               }
-                               /*
-                               ** Return module type of port
-                               */
-                               port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes;
-                               if (copyout((caddr_t)&port, (int)arg, 
-                                                       sizeof(uint)) == COPYFAIL) {
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       return -EFAULT;
-                               }
-                               return(0);
-                       /*
-                       ** 02.03.1999 ARG - ESIL 0820 fix
-                       ** We are no longer using "Boot Mode", so these ioctls
-                       ** are not required :
-                       **
-                       case RIO_GET_BOOT_MODE :
-                               rio_dprint(RIO_DEBUG_CTRL, ("Get boot mode - %x\n", p->RIOBootMode));
-                               **
-                               ** Return boot state of system - BOOT_ALL, BOOT_OWN or BOOT_NONE
-                               **
-                               if (copyout((caddr_t)&p->RIOBootMode, (int)arg, 
-                                               sizeof(p->RIOBootMode)) == COPYFAIL) {
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       return -EFAULT;
-                               }
-                               return(0);
-                       
-                       case RIO_SET_BOOT_MODE :
-                               p->RIOBootMode = (uint) arg;
-                               rio_dprint(RIO_DEBUG_CTRL, ("Set boot mode to 0x%x\n", p->RIOBootMode));
-                               return(0);
-                       **
-                       ** End ESIL 0820 fix
-                       */
-
-                       case RIO_BLOCK_OPENS:
-                               rio_dprintk (RIO_DEBUG_CTRL, "Opens block until booted\n");
-                               for ( Entry=0; Entry < RIO_PORTS; Entry++ ) {
-                                       rio_spin_lock_irqsave(&PortP->portSem, flags);
-                                       p->RIOPortp[Entry]->WaitUntilBooted = 1;
-                                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                               }
-                               return 0;
-                       
-                       case RIO_SETUP_PORTS:
-                               rio_dprintk (RIO_DEBUG_CTRL, "Setup ports\n");
-                               if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) 
-                                               == COPYFAIL ) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        rio_dprintk (RIO_DEBUG_CTRL, "EFAULT");
-                                        return -EFAULT;
-                               }
-                               if ( PortSetup.From > PortSetup.To || 
-                                                               PortSetup.To >= RIO_PORTS ) {
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        rio_dprintk (RIO_DEBUG_CTRL, "ENXIO");
-                                        return -ENXIO;
-                               }
-                               if ( PortSetup.XpCps > p->RIOConf.MaxXpCps ||
-                                        PortSetup.XpCps < p->RIOConf.MinXpCps ) {
-                                        p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE;
-                                        rio_dprintk (RIO_DEBUG_CTRL, "EINVAL");
-                                        return -EINVAL;
-                               }
-                               if ( !p->RIOPortp ) {
-                                        cprintf("No p->RIOPortp array!\n");
-                                        rio_dprintk (RIO_DEBUG_CTRL, "No p->RIOPortp array!\n");
-                                        return -EIO;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To);
-                               for (loop=PortSetup.From; loop<=PortSetup.To; loop++) {
-                               rio_dprintk (RIO_DEBUG_CTRL, "in loop (%d)!\n", loop);
+       case RIO_GET_MODTYPE:
+               if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "Get module type for port %d\n", port);
+               if (port < 0 || port > 511) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port);
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+               PortP = (p->RIOPortp[port]);
+               if (!PortP->Mapped) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port);
+                       p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
+                       return -EINVAL;
+               }
+               /*
+                ** Return module type of port
+                */
+               port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes;
+               if (copyout((caddr_t) & port, (int) arg, sizeof(uint)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return (0);
+               /*
+                ** 02.03.1999 ARG - ESIL 0820 fix
+                ** We are no longer using "Boot Mode", so these ioctls
+                ** are not required :
+                **
+                case RIO_GET_BOOT_MODE :
+                rio_dprint(RIO_DEBUG_CTRL, ("Get boot mode - %x\n", p->RIOBootMode));
+                **
+                ** Return boot state of system - BOOT_ALL, BOOT_OWN or BOOT_NONE
+                **
+                if (copyout((caddr_t)&p->RIOBootMode, (int)arg,
+                sizeof(p->RIOBootMode)) == COPYFAIL) {
+                p->RIOError.Error = COPYOUT_FAILED;
+                return -EFAULT;
+                }
+                return(0);
+
+                case RIO_SET_BOOT_MODE :
+                p->RIOBootMode = (uint) arg;
+                rio_dprint(RIO_DEBUG_CTRL, ("Set boot mode to 0x%x\n", p->RIOBootMode));
+                return(0);
+                **
+                ** End ESIL 0820 fix
+                */
+
+       case RIO_BLOCK_OPENS:
+               rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n");
+               for (Entry = 0; Entry < RIO_PORTS; Entry++) {
+                       rio_spin_lock_irqsave(&PortP->portSem, flags);
+                       p->RIOPortp[Entry]->WaitUntilBooted = 1;
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               }
+               return 0;
+
+       case RIO_SETUP_PORTS:
+               rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n");
+               if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup))
+                   == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       rio_dprintk(RIO_DEBUG_CTRL, "EFAULT");
+                       return -EFAULT;
+               }
+               if (PortSetup.From > PortSetup.To || PortSetup.To >= RIO_PORTS) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       rio_dprintk(RIO_DEBUG_CTRL, "ENXIO");
+                       return -ENXIO;
+               }
+               if (PortSetup.XpCps > p->RIOConf.MaxXpCps || PortSetup.XpCps < p->RIOConf.MinXpCps) {
+                       p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE;
+                       rio_dprintk(RIO_DEBUG_CTRL, "EINVAL");
+                       return -EINVAL;
+               }
+               if (!p->RIOPortp) {
+                       cprintf("No p->RIOPortp array!\n");
+                       rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n");
+                       return -EIO;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To);
+               for (loop = PortSetup.From; loop <= PortSetup.To; loop++) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop);
 #if 0
-                                       PortP = p->RIOPortp[loop];
-                                       if ( !PortP->TtyP )
-                                               PortP->TtyP = &p->channel[loop];
-
-                                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-                                               if ( PortSetup.IxAny )
-                                                       PortP->Config |= RIO_IXANY;
-                                               else
-                                                       PortP->Config &= ~RIO_IXANY;
-                                               if ( PortSetup.IxOn )
-                                                       PortP->Config |= RIO_IXON;
-                                               else
-                                                       PortP->Config &= ~RIO_IXON;
-                                        
-                                        /*
-                                        ** If the port needs to wait for all a processes output
-                                        ** to drain before closing then this flag will be set.
-                                        */
-                                               if (PortSetup.Drain) {
-                                                       PortP->Config |= RIO_WAITDRAIN;
-                                               } else {
-                                                       PortP->Config &= ~RIO_WAITDRAIN;
-                                               }
-                                        /*
-                                        ** Store settings if locking or unlocking port or if the
-                                        ** port is not locked, when setting the store option.
-                                        */
-                                        if (PortP->Mapped &&
-                                                ((PortSetup.Lock && !PortP->Lock) ||
-                                                       (!PortP->Lock &&
-                                                       (PortSetup.Store && !PortP->Store)))) {
-                                               PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag;
-                                               PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag;
-                                               PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag;
-                                               PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag;
-                                               PortP->StoredTty.line = PortP->TtyP->tm.c_line;
-                                               bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc,
-                                                       NCC + 5);
-                                        }
-                                        PortP->Lock = PortSetup.Lock;
-                                        PortP->Store = PortSetup.Store;
-                                        PortP->Xprint.XpCps = PortSetup.XpCps;
-                                        bcopy(PortSetup.XpOn,PortP->Xprint.XpOn,MAX_XP_CTRL_LEN);
-                                        bcopy(PortSetup.XpOff,PortP->Xprint.XpOff,MAX_XP_CTRL_LEN);
-                                        PortP->Xprint.XpOn[MAX_XP_CTRL_LEN-1] = '\0';
-                                        PortP->Xprint.XpOff[MAX_XP_CTRL_LEN-1] = '\0';
-                                        PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn)+
-                                                               RIOStrlen(PortP->Xprint.XpOff);
-                                        rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-#endif
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "after loop (%d)!\n", loop);
-                               rio_dprintk (RIO_DEBUG_CTRL, "Retval:%x\n", retval);
-                               return retval;
-
-                       case RIO_GET_PORT_SETUP :
-                               rio_dprintk (RIO_DEBUG_CTRL, "Get port setup\n");
-                               if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) 
-                                                       == COPYFAIL ) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if ( PortSetup.From >= RIO_PORTS ) {
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
+                       PortP = p->RIOPortp[loop];
+                       if (!PortP->TtyP)
+                               PortP->TtyP = &p->channel[loop];
+
+                       rio_spin_lock_irqsave(&PortP->portSem, flags);
+                       if (PortSetup.IxAny)
+                               PortP->Config |= RIO_IXANY;
+                       else
+                               PortP->Config &= ~RIO_IXANY;
+                       if (PortSetup.IxOn)
+                               PortP->Config |= RIO_IXON;
+                       else
+                               PortP->Config &= ~RIO_IXON;
 
-                               port = PortSetup.To = PortSetup.From;
-                               PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? 
-                                                                                                       1 : 0;
-                               PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? 
-                                                                                                       1 : 0;
-                               PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ?
-                                                                                                       1 : 0;
-                               PortSetup.Store = p->RIOPortp[port]->Store;
-                               PortSetup.Lock = p->RIOPortp[port]->Lock;
-                               PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps;
-                               bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn,
-                                                                                                       MAX_XP_CTRL_LEN);
-                               bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff,
-                                                                                                       MAX_XP_CTRL_LEN);
-                               PortSetup.XpOn[MAX_XP_CTRL_LEN-1] = '\0';
-                               PortSetup.XpOff[MAX_XP_CTRL_LEN-1] = '\0';
-
-                               if ( copyout((caddr_t)&PortSetup,(int)arg,sizeof(PortSetup))
-                                                                                                               ==COPYFAIL ) {
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return retval;
-
-                       case RIO_GET_PORT_PARAMS :
-                               rio_dprintk (RIO_DEBUG_CTRL, "Get port params\n");
-                               if (copyin( (int)arg, (caddr_t)&PortParams,
-                                       sizeof(struct PortParams)) == COPYFAIL) {
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
-                               if (PortParams.Port >= RIO_PORTS) {
-                                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                       return -ENXIO;
-                               }
-                               PortP = (p->RIOPortp[PortParams.Port]);
-                               PortParams.Config = PortP->Config;
-                               PortParams.State = PortP->State;
-                               rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port);
-
-                               if (copyout((caddr_t)&PortParams, (int)arg, 
-                                               sizeof(struct PortParams)) == COPYFAIL ) {
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return retval;
-
-                       case RIO_GET_PORT_TTY :
-                               rio_dprintk (RIO_DEBUG_CTRL, "Get port tty\n");
-                               if (copyin((int)arg, (caddr_t)&PortTty, sizeof(struct PortTty)) 
-                                               == COPYFAIL) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if ( PortTty.port >= RIO_PORTS ) {
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-
-                               rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
-                               PortP = (p->RIOPortp[PortTty.port]);
+                       /*
+                        ** If the port needs to wait for all a processes output
+                        ** to drain before closing then this flag will be set.
+                        */
+                       if (PortSetup.Drain) {
+                               PortP->Config |= RIO_WAITDRAIN;
+                       } else {
+                               PortP->Config &= ~RIO_WAITDRAIN;
+                       }
+                       /*
+                        ** Store settings if locking or unlocking port or if the
+                        ** port is not locked, when setting the store option.
+                        */
+                       if (PortP->Mapped && ((PortSetup.Lock && !PortP->Lock) || (!PortP->Lock && (PortSetup.Store && !PortP->Store)))) {
+                               PortP->StoredTty.iflag = PortP->TtyP->tm.c_iflag;
+                               PortP->StoredTty.oflag = PortP->TtyP->tm.c_oflag;
+                               PortP->StoredTty.cflag = PortP->TtyP->tm.c_cflag;
+                               PortP->StoredTty.lflag = PortP->TtyP->tm.c_lflag;
+                               PortP->StoredTty.line = PortP->TtyP->tm.c_line;
+                               bcopy(PortP->TtyP->tm.c_cc, PortP->StoredTty.cc, NCC + 5);
+                       }
+                       PortP->Lock = PortSetup.Lock;
+                       PortP->Store = PortSetup.Store;
+                       PortP->Xprint.XpCps = PortSetup.XpCps;
+                       bcopy(PortSetup.XpOn, PortP->Xprint.XpOn, MAX_XP_CTRL_LEN);
+                       bcopy(PortSetup.XpOff, PortP->Xprint.XpOff, MAX_XP_CTRL_LEN);
+                       PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
+                       PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
+                       PortP->Xprint.XpLen = RIOStrlen(PortP->Xprint.XpOn) + RIOStrlen(PortP->Xprint.XpOff);
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+#endif
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop);
+               rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval);
+               return retval;
+
+       case RIO_GET_PORT_SETUP:
+               rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n");
+               if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup))
+                   == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (PortSetup.From >= RIO_PORTS) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+
+               port = PortSetup.To = PortSetup.From;
+               PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? 1 : 0;
+               PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? 1 : 0;
+               PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? 1 : 0;
+               PortSetup.Store = p->RIOPortp[port]->Store;
+               PortSetup.Lock = p->RIOPortp[port]->Lock;
+               PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps;
+               bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, MAX_XP_CTRL_LEN);
+               bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, MAX_XP_CTRL_LEN);
+               PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
+               PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
+
+               if (copyout((caddr_t) & PortSetup, (int) arg, sizeof(PortSetup))
+                   == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_GET_PORT_PARAMS:
+               rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n");
+               if (copyin((int) arg, (caddr_t) & PortParams, sizeof(struct PortParams)) == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (PortParams.Port >= RIO_PORTS) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+               PortP = (p->RIOPortp[PortParams.Port]);
+               PortParams.Config = PortP->Config;
+               PortParams.State = PortP->State;
+               rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port);
+
+               if (copyout((caddr_t) & PortParams, (int) arg, sizeof(struct PortParams)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_GET_PORT_TTY:
+               rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n");
+               if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty))
+                   == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (PortTty.port >= RIO_PORTS) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+
+               rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
+               PortP = (p->RIOPortp[PortTty.port]);
 #if 0
-                               PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag;
-                               PortTty.Tty.tm.c_oflag = PortP->TtyP->tm.c_oflag;
-                               PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag;
-                               PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag;
+               PortTty.Tty.tm.c_iflag = PortP->TtyP->tm.c_iflag;
+               PortTty.Tty.tm.c_oflag = PortP->TtyP->tm.c_oflag;
+               PortTty.Tty.tm.c_cflag = PortP->TtyP->tm.c_cflag;
+               PortTty.Tty.tm.c_lflag = PortP->TtyP->tm.c_lflag;
 #endif
-                               if (copyout((caddr_t)&PortTty, (int)arg, 
-                                                       sizeof(struct PortTty)) == COPYFAIL) {
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       return -EFAULT;
-                               }
-                               return retval;
-
-                       case RIO_SET_PORT_TTY :
-                               if (copyin((int)arg, (caddr_t)&PortTty, 
-                                               sizeof(struct PortTty)) == COPYFAIL) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port);
-                               if (PortTty.port >= (ushort) RIO_PORTS) {
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-                               PortP = (p->RIOPortp[PortTty.port]);
+               if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_SET_PORT_TTY:
+               if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port);
+               if (PortTty.port >= (ushort) RIO_PORTS) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+               PortP = (p->RIOPortp[PortTty.port]);
 #if 0
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-                               PortP->TtyP->tm.c_iflag = PortTty.Tty.tm.c_iflag;
-                               PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag;
-                               PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag;
-                               PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag;
-                               rio_spin_unlock_irqrestore( &PortP->portSem , flags);
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+               PortP->TtyP->tm.c_iflag = PortTty.Tty.tm.c_iflag;
+               PortP->TtyP->tm.c_oflag = PortTty.Tty.tm.c_oflag;
+               PortP->TtyP->tm.c_cflag = PortTty.Tty.tm.c_cflag;
+               PortP->TtyP->tm.c_lflag = PortTty.Tty.tm.c_lflag;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
 #endif
 
-                               RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP);
-                               return retval;
-
-                       case RIO_SET_PORT_PARAMS :
-                               rio_dprintk (RIO_DEBUG_CTRL, "Set port params\n");
-                               if ( copyin((int)arg, (caddr_t)&PortParams, sizeof(PortParams))
-                                       == COPYFAIL ) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if (PortParams.Port >= (ushort) RIO_PORTS) {
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-                               PortP = (p->RIOPortp[PortParams.Port]);
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-                               PortP->Config = PortParams.Config;
-                               rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                               return retval;
-
-                       case RIO_GET_PORT_STATS :
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n");
-                               if ( copyin((int)arg, (caddr_t)&portStats, 
-                                               sizeof(struct portStats)) == COPYFAIL ) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if ( portStats.port >= RIO_PORTS ) {
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-                               PortP = (p->RIOPortp[portStats.port]);
-                               portStats.gather = PortP->statsGather;
-                               portStats.txchars = PortP->txchars;
-                               portStats.rxchars = PortP->rxchars;
-                               portStats.opens = PortP->opens;
-                               portStats.closes = PortP->closes;
-                               portStats.ioctls = PortP->ioctls;
-                               if ( copyout((caddr_t)&portStats, (int)arg, 
-                                                       sizeof(struct portStats)) == COPYFAIL ) {
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return retval;
-
-                       case RIO_RESET_PORT_STATS :
-                               port = (uint) arg;
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n");
-                               if ( port >= RIO_PORTS ) {
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-                               PortP = (p->RIOPortp[port]);
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-                               PortP->txchars  = 0;
-                               PortP->rxchars  = 0;
-                               PortP->opens    = 0;
-                               PortP->closes   = 0;
-                               PortP->ioctls   = 0;
-                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                               return retval;
-
-                       case RIO_GATHER_PORT_STATS :
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n");
-                               if ( copyin( (int)arg, (caddr_t)&portStats, 
-                                               sizeof(struct portStats)) == COPYFAIL ) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if ( portStats.port >= RIO_PORTS ) {
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-                               PortP = (p->RIOPortp[portStats.port]);
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-                               PortP->statsGather = portStats.gather;
-                               rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                               return retval;
+               RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP);
+               return retval;
+
+       case RIO_SET_PORT_PARAMS:
+               rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n");
+               if (copyin((int) arg, (caddr_t) & PortParams, sizeof(PortParams))
+                   == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (PortParams.Port >= (ushort) RIO_PORTS) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+               PortP = (p->RIOPortp[PortParams.Port]);
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+               PortP->Config = PortParams.Config;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return retval;
+
+       case RIO_GET_PORT_STATS:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n");
+               if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (portStats.port >= RIO_PORTS) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+               PortP = (p->RIOPortp[portStats.port]);
+               portStats.gather = PortP->statsGather;
+               portStats.txchars = PortP->txchars;
+               portStats.rxchars = PortP->rxchars;
+               portStats.opens = PortP->opens;
+               portStats.closes = PortP->closes;
+               portStats.ioctls = PortP->ioctls;
+               if (copyout((caddr_t) & portStats, (int) arg, sizeof(struct portStats)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_RESET_PORT_STATS:
+               port = (uint) arg;
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n");
+               if (port >= RIO_PORTS) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+               PortP = (p->RIOPortp[port]);
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+               PortP->txchars = 0;
+               PortP->rxchars = 0;
+               PortP->opens = 0;
+               PortP->closes = 0;
+               PortP->ioctls = 0;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return retval;
+
+       case RIO_GATHER_PORT_STATS:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n");
+               if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (portStats.port >= RIO_PORTS) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+               PortP = (p->RIOPortp[portStats.port]);
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+               PortP->statsGather = portStats.gather;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return retval;
 
 #ifdef DEBUG_SUPPORTED
-                       case RIO_READ_LEVELS:
-                               {
-                                        int num;
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n");
-                                        for ( num=0; RIODbInf[num].Flag; num++ ) ;
-                                        rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copy\n",num);
-                                        if (copyout((caddr_t)RIODbInf,(int)arg,
-                                               sizeof(struct DbInf)*(num+1))==COPYFAIL) {
-                                               rio_dprintk (RIO_DEBUG_CTRL, "ReadLevels Copy failed\n");
-                                               p->RIOError.Error = COPYOUT_FAILED;
-                                               return -EFAULT;
-                                        }
-                                        rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copied\n",num);
-                                        return retval;
-                               }
+       case RIO_READ_LEVELS:
+               {
+                       int num;
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_LEVELS\n");
+                       for (num = 0; RIODbInf[num].Flag; num++);
+                       rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copy\n", num);
+                       if (copyout((caddr_t) RIODbInf, (int) arg, sizeof(struct DbInf) * (num + 1)) == COPYFAIL) {
+                               rio_dprintk(RIO_DEBUG_CTRL, "ReadLevels Copy failed\n");
+                               p->RIOError.Error = COPYOUT_FAILED;
+                               return -EFAULT;
+                       }
+                       rio_dprintk(RIO_DEBUG_CTRL, "%d levels to copied\n", num);
+                       return retval;
+               }
 #endif
 
-                        case RIO_READ_CONFIG:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
-                               if (copyout((caddr_t)&p->RIOConf, (int)arg, 
-                                                       sizeof(struct Conf)) ==COPYFAIL ) {
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return retval;
-
-                       case RIO_SET_CONFIG:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n");
-                               if ( !su ) {
-                                        p->RIOError.Error = NOT_SUPER_USER;
-                                        return -EPERM;
+       case RIO_READ_CONFIG:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
+               if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_SET_CONFIG:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n");
+               if (!su) {
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               if (copyin((int) arg, (caddr_t) & p->RIOConf, sizeof(struct Conf))
+                   == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               /*
+                ** move a few value around
+                */
+               for (Host = 0; Host < p->RIONumHosts; Host++)
+                       if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING)
+                               WWORD(p->RIOHosts[Host].ParmMapP->timer, p->RIOConf.Timer);
+               return retval;
+
+       case RIO_START_POLLER:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_START_POLLER\n");
+               return -EINVAL;
+
+       case RIO_STOP_POLLER:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n");
+               if (!su) {
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               p->RIOPolling = NOT_POLLING;
+               return retval;
+
+       case RIO_SETDEBUG:
+       case RIO_GETDEBUG:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n");
+               if (copyin((int) arg, (caddr_t) & DebugCtrl, sizeof(DebugCtrl))
+                   == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (DebugCtrl.SysPort == NO_PORT) {
+                       if (cmd == RIO_SETDEBUG) {
+                               if (!su) {
+                                       p->RIOError.Error = NOT_SUPER_USER;
+                                       return -EPERM;
                                }
-                               if ( copyin((int)arg, (caddr_t)&p->RIOConf, sizeof(struct Conf) )
-                                               ==COPYFAIL ) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
+                               p->rio_debug = DebugCtrl.Debug;
+                               p->RIODebugWait = DebugCtrl.Wait;
+                               rio_dprintk(RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", p->rio_debug, p->RIODebugWait);
+                       } else {
+                               rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait);
+                               DebugCtrl.Debug = p->rio_debug;
+                               DebugCtrl.Wait = p->RIODebugWait;
+                               if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) {
+                                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
+                                       p->RIOError.Error = COPYOUT_FAILED;
+                                       return -EFAULT;
                                }
-                               /*
-                               ** move a few value around
-                               */
-                               for (Host=0; Host < p->RIONumHosts; Host++)
-                                        if ( (p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING )
-                                               WWORD(p->RIOHosts[Host].ParmMapP->timer , 
-                                                               p->RIOConf.Timer);
-                               return retval;
-
-                       case RIO_START_POLLER:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_START_POLLER\n");
-                               return -EINVAL;
+                       }
+               } else if (DebugCtrl.SysPort >= RIO_PORTS && DebugCtrl.SysPort != NO_PORT) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               } else if (cmd == RIO_SETDEBUG) {
+                       if (!su) {
+                               p->RIOError.Error = NOT_SUPER_USER;
+                               return -EPERM;
+                       }
+                       rio_spin_lock_irqsave(&PortP->portSem, flags);
+                       p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug;
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
+               } else {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
+                       DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug;
+                       if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) {
+                               rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
+                               p->RIOError.Error = COPYOUT_FAILED;
+                               return -EFAULT;
+                       }
+               }
+               return retval;
 
-                       case RIO_STOP_POLLER:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n");
-                               if ( !su ) {
-                                        p->RIOError.Error = NOT_SUPER_USER;
-                                        return -EPERM;
-                               }
-                               p->RIOPolling = NOT_POLLING;
-                               return retval;
-
-                       case RIO_SETDEBUG:
-                       case RIO_GETDEBUG:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n");
-                               if ( copyin( (int)arg, (caddr_t)&DebugCtrl, sizeof(DebugCtrl) )
-                                                       ==COPYFAIL ) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if ( DebugCtrl.SysPort == NO_PORT ) {
-                                       if ( cmd == RIO_SETDEBUG ) {
-                                               if ( !su ) {
-                                                       p->RIOError.Error = NOT_SUPER_USER;
-                                                       return -EPERM;
-                                               }
-                                               p->rio_debug = DebugCtrl.Debug;
-                                               p->RIODebugWait = DebugCtrl.Wait;
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n",
-                                                       p->rio_debug,p->RIODebugWait);
-                                       }
-                                       else {
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n",
-                                                                               p->rio_debug,p->RIODebugWait);
-                                               DebugCtrl.Debug = p->rio_debug;
-                                               DebugCtrl.Wait  = p->RIODebugWait;
-                                               if ( copyout((caddr_t)&DebugCtrl,(int)arg,
-                                                               sizeof(DebugCtrl)) == COPYFAIL ) {
-                                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n",
-                                                                       DebugCtrl.SysPort);
-                                                       p->RIOError.Error = COPYOUT_FAILED;
-                                                       return -EFAULT;
-                                               }
-                                       }
-                               }
-                               else if ( DebugCtrl.SysPort >= RIO_PORTS && 
-                                                       DebugCtrl.SysPort != NO_PORT ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n",
-                                                                       DebugCtrl.SysPort);
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-                               else if ( cmd == RIO_SETDEBUG ) {
-                                       if ( !su ) {
-                                               p->RIOError.Error = NOT_SUPER_USER;
-                                               return -EPERM;
-                                       }
-                                       rio_spin_lock_irqsave(&PortP->portSem, flags);
-                                       p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug;
-                                       rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n",
-                                                               p->RIOPortp[DebugCtrl.SysPort]->Debug);
-                               }
-                               else {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n",
-                                                                        p->RIOPortp[DebugCtrl.SysPort]->Debug);
-                                       DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug;
-                                       if ( copyout((caddr_t)&DebugCtrl,(int)arg,
-                                                               sizeof(DebugCtrl))==COPYFAIL ) {
-                                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
-                                               p->RIOError.Error = COPYOUT_FAILED;
-                                               return -EFAULT;
-                                       }
-                               }
-                               return retval;
-
-                       case RIO_VERSID:
-                               /*
-                               ** Enquire about the release and version.
-                               ** We return MAX_VERSION_LEN bytes, being a
-                               ** textual null terminated string.
-                               */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID\n");
-                               if ( copyout(   (caddr_t)RIOVersid(),
-                                               (int)arg,
-                                               sizeof(struct rioVersion) ) == COPYFAIL )
-                               {
-                                        rio_dprintk (RIO_DEBUG_CTRL,  "RIO_VERSID: Bad copy to user space (host=%d)\n", Host);
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return retval;
+       case RIO_VERSID:
+               /*
+                ** Enquire about the release and version.
+                ** We return MAX_VERSION_LEN bytes, being a
+                ** textual null terminated string.
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n");
+               if (copyout((caddr_t) RIOVersid(), (int) arg, sizeof(struct rioVersion)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host);
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return retval;
 
-                       /*
-                       ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-                       ** !! commented out previous 'RIO_VERSID' functionality !!
-                       ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-                       **
-                       case RIO_VERSID:
-                               **
-                               ** Enquire about the release and version.
-                               ** We return MAX_VERSION_LEN bytes, being a textual null
-                               ** terminated string.
-                               **
-                               rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n"));
-                               if (copyout((caddr_t)RIOVersid(), 
-                                               (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) {
-                                        rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host));
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return retval;
-                       **
-                       ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-                       */
-
-                       case RIO_NUM_HOSTS:
-                               /*
-                               ** Enquire as to the number of hosts located
-                               ** at init time.
-                               */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n");
-                               if (copyout((caddr_t)&p->RIONumHosts, (int)arg, 
-                                                       sizeof(p->RIONumHosts) )==COPYFAIL ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return retval;
-
-                       case RIO_HOST_FOAD:
-                               /*
-                               ** Kill host. This may not be in the final version...
-                               */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int)arg);
-                               if ( !su ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n");
-                                        p->RIOError.Error = NOT_SUPER_USER;
-                                        return -EPERM;
-                               }
-                               p->RIOHalted = 1;
-                               p->RIOSystemUp = 0;
-
-                               for ( Host=0; Host<p->RIONumHosts; Host++ ) {
-                                        (void)RIOBoardTest( p->RIOHosts[Host].PaddrP, 
-                                               p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, 
-                                                               p->RIOHosts[Host].Slot );
-                                        bzero( (caddr_t)&p->RIOHosts[Host].Flags, 
-                                                       ((int)&p->RIOHosts[Host].____end_marker____) -
-                                                                ((int)&p->RIOHosts[Host].Flags) );
-                                        p->RIOHosts[Host].Flags  = RC_WAITING;
+               /*
+                ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                ** !! commented out previous 'RIO_VERSID' functionality !!
+                ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                **
+                case RIO_VERSID:
+                **
+                ** Enquire about the release and version.
+                ** We return MAX_VERSION_LEN bytes, being a textual null
+                ** terminated string.
+                **
+                rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n"));
+                if (copyout((caddr_t)RIOVersid(),
+                (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) {
+                rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host));
+                p->RIOError.Error = COPYOUT_FAILED;
+                return -EFAULT;
+                }
+                return retval;
+                **
+                ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                */
+
+       case RIO_NUM_HOSTS:
+               /*
+                ** Enquire as to the number of hosts located
+                ** at init time.
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n");
+               if (copyout((caddr_t) & p->RIONumHosts, (int) arg, sizeof(p->RIONumHosts)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_HOST_FOAD:
+               /*
+                ** Kill host. This may not be in the final version...
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int) arg);
+               if (!su) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n");
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               p->RIOHalted = 1;
+               p->RIOSystemUp = 0;
+
+               for (Host = 0; Host < p->RIONumHosts; Host++) {
+                       (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot);
+                       bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags));
+                       p->RIOHosts[Host].Flags = RC_WAITING;
 #if 0
-                                        RIOSetupDataStructs(p);
+                       RIOSetupDataStructs(p);
 #endif
-                               }
-                               RIOFoadWakeup(p);
-                               p->RIONumBootPkts = 0;
-                               p->RIOBooting = 0;
+               }
+               RIOFoadWakeup(p);
+               p->RIONumBootPkts = 0;
+               p->RIOBooting = 0;
 
 #ifdef RINGBUFFER_SUPPORT
-                               for( loop=0; loop<RIO_PORTS; loop++ )
-                                       if ( p->RIOPortp[loop]->TxRingBuffer )
-                                               sysfree((void *)p->RIOPortp[loop]->TxRingBuffer, 
-                                                       RIOBufferSize );
+               for (loop = 0; loop < RIO_PORTS; loop++)
+                       if (p->RIOPortp[loop]->TxRingBuffer)
+                               sysfree((void *) p->RIOPortp[loop]->TxRingBuffer, RIOBufferSize);
 #endif
 #if 0
-                               bzero((caddr_t)&p->RIOPortp[0],RIO_PORTS*sizeof(struct Port));
+               bzero((caddr_t) & p->RIOPortp[0], RIO_PORTS * sizeof(struct Port));
 #else
-                               printk ("HEEEEELP!\n");
+               printk("HEEEEELP!\n");
 #endif
 
-                               for( loop=0; loop<RIO_PORTS; loop++ ) {
+               for (loop = 0; loop < RIO_PORTS; loop++) {
 #if 0
-                                       p->RIOPortp[loop]->TtyP = &p->channel[loop];
+                       p->RIOPortp[loop]->TtyP = &p->channel[loop];
 #endif
-                                       
-                                       spin_lock_init(&p->RIOPortp[loop]->portSem);
-                                       p->RIOPortp[loop]->InUse = NOT_INUSE;
-                               }
-
-                               p->RIOSystemUp = 0;
-                               return retval;
-
-                       case RIO_DOWNLOAD:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n");
-                               if ( !su ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n");
-                                        p->RIOError.Error = NOT_SUPER_USER;
-                                        return -EPERM;
-                               }
-                               if ( copyin((int)arg, (caddr_t)&DownLoad, 
-                                                       sizeof(DownLoad) )==COPYFAIL ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n",
-                                   DownLoad.ProductCode);
-
-                               /*
-                               ** It is important that the product code is an unsigned object!
-                               */
-                               if ( DownLoad.ProductCode > MAX_PRODUCT ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n",
-                                                       DownLoad.ProductCode);
-                                        p->RIOError.Error = NO_SUCH_PRODUCT;
-                                        return -ENXIO;
-                               }
-                               /*
-                               ** do something!
-                               */
-                               retval = (*(RIOBootTable[DownLoad.ProductCode]))(p, &DownLoad);
-                                                                               /* <-- Panic */
-                               p->RIOHalted = 0;
-                               /*
-                               ** and go back, content with a job well completed.
-                               */
-                               return retval;
-
-                       case RIO_PARMS:
-                               {
-                                       uint host;
-
-                                       if (copyin((int)arg, (caddr_t)&host, 
-                                                       sizeof(host) ) == COPYFAIL ) {
-                                               rio_dprintk (RIO_DEBUG_CTRL, 
-                                                       "RIO_HOST_REQ: Copy in from user space failed\n");
-                                               p->RIOError.Error = COPYIN_FAILED;
-                                               return -EFAULT;
-                                       }
-                                       /*
-                                       ** Fetch the parmmap
-                                       */
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS\n");
-                                       if ( copyout( (caddr_t)p->RIOHosts[host].ParmMapP, 
-                                                               (int)arg, sizeof(PARM_MAP) )==COPYFAIL ) {
-                                               p->RIOError.Error = COPYOUT_FAILED;
-                                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n");
-                                               return -EFAULT;
-                                       }
-                               }
-                               return retval;
-
-                       case RIO_HOST_REQ:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ\n");
-                               if (copyin((int)arg, (caddr_t)&HostReq, 
-                                                       sizeof(HostReq) )==COPYFAIL ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if ( HostReq.HostNum >= p->RIONumHosts ) {
-                                        p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n",
-                                                       HostReq.HostNum);
-                                        return -ENXIO;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum);
 
-                               if (copyout((caddr_t)&p->RIOHosts[HostReq.HostNum], 
-                                       (int)HostReq.HostP,sizeof(struct Host) ) == COPYFAIL) {
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n");
-                                       return -EFAULT;
-                               }
-                               return retval;
-
-                        case RIO_HOST_DPRAM:
-                               rio_dprintk (RIO_DEBUG_CTRL, "Request for DPRAM\n");
-                               if ( copyin( (int)arg, (caddr_t)&HostDpRam, 
-                                                               sizeof(HostDpRam) )==COPYFAIL ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
-                               if ( HostDpRam.HostNum >= p->RIONumHosts ) {
-                                       p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n",
-                                                                               HostDpRam.HostNum);
-                                       return -ENXIO;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum);
-
-                               if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) {
-                                        int off;
-                                        /* It's hardware like this that really gets on my tits. */
-                                        static unsigned char copy[sizeof(struct DpRam)];
-                                       for ( off=0; off<sizeof(struct DpRam); off++ )
-                                               copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off];
-                                       if ( copyout( (caddr_t)copy, (int)HostDpRam.DpRamP, 
-                                                       sizeof(struct DpRam) ) == COPYFAIL ) {
-                                               p->RIOError.Error = COPYOUT_FAILED;
-                                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
-                                               return -EFAULT;
-                                       }
-                               }
-                               else if (copyout((caddr_t)p->RIOHosts[HostDpRam.HostNum].Caddr,
-                                       (int)HostDpRam.DpRamP, 
-                                               sizeof(struct DpRam) ) == COPYFAIL ) {
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
-                                        return -EFAULT;
-                               }
-                               return retval;
-
-                        case RIO_SET_BUSY:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY\n");
-                               if ( (int)arg < 0 || (int)arg > 511 ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n",(int)arg);
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -EINVAL;
-                               }
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-                               p->RIOPortp[(int)arg]->State |= RIO_BUSY;
-                               rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                               return retval;
-
-                        case RIO_HOST_PORT:
-                               /*
-                               ** The daemon want port information
-                               ** (probably for debug reasons)
-                               */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT\n");
-                               if ( copyin((int)arg, (caddr_t)&PortReq, 
-                                       sizeof(PortReq) )==COPYFAIL ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
-                                       p->RIOError.Error = COPYIN_FAILED;
-                                       return -EFAULT;
-                               }
-
-                               if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n",
-                                                                                       PortReq.SysPort);
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort);
-                               if (copyout((caddr_t)p->RIOPortp[PortReq.SysPort], 
-                                                        (int)PortReq.PortP,
-                                                               sizeof(struct Port) ) == COPYFAIL) {
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n");
-                                        return -EFAULT;
-                               }
-                               return retval;
-
-                       case RIO_HOST_RUP:
-                               /*
-                               ** The daemon want rup information
-                               ** (probably for debug reasons)
-                               */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP\n");
-                               if (copyin((int)arg, (caddr_t)&RupReq, 
-                                               sizeof(RupReq) )==COPYFAIL ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n",
-                                                               RupReq.HostNum);
-                                        p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-                               if ( RupReq.RupNum >= MAX_RUP+LINKS_PER_UNIT ) { /* eek! */
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n",
-                                                       RupReq.RupNum);
-                                        p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
-                                        return -EINVAL;
-                               }
-                               HostP = &p->RIOHosts[RupReq.HostNum];
-
-                               if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n",
-                                                       RupReq.HostNum);
-                                        p->RIOError.Error = HOST_NOT_RUNNING;
-                                        return -EIO;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "Request for rup %d from host %d\n",
-                                               RupReq.RupNum,RupReq.HostNum);
-
-                               if (copyout((caddr_t)HostP->UnixRups[RupReq.RupNum].RupP,
-                                       (int)RupReq.RupP,sizeof(struct RUP) ) == COPYFAIL) {
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n");
-                                       return -EFAULT;
-                               }
-                               return retval;
-
-                       case RIO_HOST_LPB:
-                               /*
-                               ** The daemon want lpb information
-                               ** (probably for debug reasons)
-                               */
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB\n");
-                               if (copyin((int)arg, (caddr_t)&LpbReq, 
-                                       sizeof(LpbReq) )==COPYFAIL ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n",
-                                                       LpbReq.Host);
-                                       p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
-                                       return -ENXIO;
-                               }
-                               if ( LpbReq.Link >= LINKS_PER_UNIT ) { /* eek! */
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n",
-                                                       LpbReq.Link);
-                                        p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE;
-                                        return -EINVAL;
-                               }
-                               HostP = &p->RIOHosts[LpbReq.Host];
-
-                               if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n",
-                                               LpbReq.Host );
-                                        p->RIOError.Error = HOST_NOT_RUNNING;
-                                        return -EIO;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n",
-                                       LpbReq.Link, LpbReq.Host);
-
-                               if (copyout((caddr_t)&HostP->LinkStrP[LpbReq.Link],
-                                       (int)LpbReq.LpbP,sizeof(struct LPB) ) == COPYFAIL) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       return -EFAULT;
-                               }
-                               return retval;
-
-                               /*
-                               ** Here 3 IOCTL's that allow us to change the way in which
-                               ** rio logs errors. send them just to syslog or send them
-                               ** to both syslog and console or send them to just the console.
-                               **
-                               ** See RioStrBuf() in util.c for the other half.
-                               */
-                       case RIO_SYSLOG_ONLY:
-                               p->RIOPrintLogState = PRINT_TO_LOG;     /* Just syslog */
-                               return 0;
-
-                       case RIO_SYSLOG_CONS:
-                               p->RIOPrintLogState = PRINT_TO_LOG_CONS;/* syslog and console */
-                               return 0;
-
-                       case RIO_CONS_ONLY:
-                               p->RIOPrintLogState = PRINT_TO_CONS;    /* Just console */
-                               return 0;
-
-                       case RIO_SIGNALS_ON:
-                               if ( p->RIOSignalProcess ) {
-                                        p->RIOError.Error = SIGNALS_ALREADY_SET;
-                                        return -EBUSY;
-                               }
-                               p->RIOSignalProcess = getpid();
-                               p->RIOPrintDisabled = DONT_PRINT;
-                               return retval;
-
-                       case RIO_SIGNALS_OFF:
-                               if ( p->RIOSignalProcess != getpid() ) {
-                                        p->RIOError.Error = NOT_RECEIVING_PROCESS;
-                                        return -EPERM;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "Clear signal process to zero\n");
-                               p->RIOSignalProcess = 0;
-                               return retval;
-
-                       case RIO_SET_BYTE_MODE:
-                               for ( Host=0; Host<p->RIONumHosts; Host++ )
-                                        if ( p->RIOHosts[Host].Type == RIO_AT )
-                                                p->RIOHosts[Host].Mode &= ~WORD_OPERATION;
-                               return retval;
-
-                       case RIO_SET_WORD_MODE:
-                               for ( Host=0; Host<p->RIONumHosts; Host++ )
-                                        if ( p->RIOHosts[Host].Type == RIO_AT )
-                                                p->RIOHosts[Host].Mode |= WORD_OPERATION;
-                               return retval;
-
-                       case RIO_SET_FAST_BUS:
-                               for ( Host=0; Host<p->RIONumHosts; Host++ )
-                                        if ( p->RIOHosts[Host].Type == RIO_AT )
-                                                p->RIOHosts[Host].Mode |= FAST_AT_BUS;
-                               return retval;
-
-                       case RIO_SET_SLOW_BUS:
-                               for ( Host=0; Host<p->RIONumHosts; Host++ )
-                                        if ( p->RIOHosts[Host].Type == RIO_AT )
-                                                p->RIOHosts[Host].Mode &= ~FAST_AT_BUS;
-                               return retval;
-
-                       case RIO_MAP_B50_TO_50:
-                       case RIO_MAP_B50_TO_57600:
-                       case RIO_MAP_B110_TO_110:
-                       case RIO_MAP_B110_TO_115200:
-                               rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping\n");
-                               port = (uint) arg;
-                               if ( port < 0 || port > 511 ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port);
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -EINVAL;
-                               }
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-                               switch( cmd )
-                               {
-                                       case RIO_MAP_B50_TO_50 :
-                                               p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50;
-                                               break;
-                                       case RIO_MAP_B50_TO_57600 :
-                                               p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50;
-                                               break;
-                                       case RIO_MAP_B110_TO_110 :
-                                               p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110;
-                                               break;
-                                       case RIO_MAP_B110_TO_115200 :
-                                               p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110;
-                                               break;
-                               }
-                               rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                               return retval;
-
-                       case RIO_STREAM_INFO:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n");
-                               return -EINVAL;
+                       spin_lock_init(&p->RIOPortp[loop]->portSem);
+                       p->RIOPortp[loop]->InUse = NOT_INUSE;
+               }
+
+               p->RIOSystemUp = 0;
+               return retval;
+
+       case RIO_DOWNLOAD:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n");
+               if (!su) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n");
+                       p->RIOError.Error = NOT_SUPER_USER;
+                       return -EPERM;
+               }
+               if (copyin((int) arg, (caddr_t) & DownLoad, sizeof(DownLoad)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", DownLoad.ProductCode);
 
-                       case RIO_SEND_PACKET:
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n");
-                               if ( copyin( (int)arg, (caddr_t)&SendPack,
-                                                                       sizeof(SendPack) )==COPYFAIL ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               if ( SendPack.PortNum >= 128 ) {
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -ENXIO;
-                               }
-
-                               PortP = p->RIOPortp[SendPack.PortNum];
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-
-                               if ( !can_add_transmit(&PacketP,PortP) ) {
-                                        p->RIOError.Error = UNIT_IS_IN_USE;
-                                        rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                                        return -ENOSPC;
-                               }
-
-                               for ( loop=0; loop<(ushort)(SendPack.Len & 127); loop++ )
-                                        WBYTE(PacketP->data[loop], SendPack.Data[loop] );
-
-                               WBYTE(PacketP->len, SendPack.Len);
-
-                               add_transmit( PortP );
-                               /*
-                               ** Count characters transmitted for port statistics reporting
-                               */
-                               if (PortP->statsGather)
-                                        PortP->txchars += (SendPack.Len & 127);
-                               rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                               return retval;
-
-                       case RIO_NO_MESG:
-                               if ( su )
-                                        p->RIONoMessage = 1;
-                               return su ? 0 : -EPERM;
-
-                       case RIO_MESG:
-                               if ( su )
-                                       p->RIONoMessage = 0;
-                               return su ? 0 : -EPERM;
-
-                       case RIO_WHAT_MESG:
-                               if ( copyout( (caddr_t)&p->RIONoMessage, (int)arg, 
-                                       sizeof(p->RIONoMessage) )==COPYFAIL ) {
-                                       rio_dprintk (RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
-                                       p->RIOError.Error = COPYOUT_FAILED;
-                                       return -EFAULT;
-                               }
-                               return 0;
-
-                       case RIO_MEM_DUMP :
-                               if (copyin((int)arg, (caddr_t)&SubCmd, 
-                                               sizeof(struct SubCmdStruct)) == COPYFAIL) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", 
-                                               SubCmd.Host, SubCmd.Rup, SubCmd.Addr);
-
-                               if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) {
-                                        p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
-                                        return -EINVAL;
-                               }
-
-                               if (SubCmd.Host >= p->RIONumHosts ) {
-                                        p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
-                                        return -EINVAL;
-                               }
-
-                               port = p->RIOHosts[SubCmd.Host].
-                                                               UnixRups[SubCmd.Rup].BaseSysPort;
-
-                               PortP = p->RIOPortp[port];
-
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-
-                               if ( RIOPreemptiveCmd(p,  PortP, MEMDUMP ) == RIO_FAIL ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n");
-                                        rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                                        return -EBUSY;
-                               }
-                               else
-                                        PortP->State |= RIO_BUSY;
-
-                               rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                               if ( copyout( (caddr_t)p->RIOMemDump, (int)arg, 
-                                                       MEMDUMP_SIZE) == COPYFAIL ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return 0;
-
-                       case RIO_TICK:
-                               if ((int)arg < 0 || (int)arg >= p->RIONumHosts)
-                                        return -EINVAL;
-                               rio_dprintk (RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int)arg);
-                               WBYTE(p->RIOHosts[(int)arg].SetInt , 0xff);
-                               return 0;
-
-                       case RIO_TOCK:
-                               if ((int)arg < 0 || (int)arg >= p->RIONumHosts)
-                                        return -EINVAL;
-                               rio_dprintk (RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int)arg);
-                               WBYTE((p->RIOHosts[(int)arg].ResetInt) , 0xff);
-                               return 0;
-
-                       case RIO_READ_CHECK:
-                               /* Check reads for pkts with data[0] the same */
-                               p->RIOReadCheck = !p->RIOReadCheck;
-                               if (copyout((caddr_t)&p->RIOReadCheck,(int)arg,
-                                                       sizeof(uint))== COPYFAIL) {
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return 0;
-
-                       case RIO_READ_REGISTER :
-                               if (copyin((int)arg, (caddr_t)&SubCmd, 
-                                                       sizeof(struct SubCmdStruct)) == COPYFAIL) {
-                                        p->RIOError.Error = COPYIN_FAILED;
-                                        return -EFAULT;
-                               }
-                               rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", 
-                                               SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr);
-
-                               if (SubCmd.Port > 511) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", 
-                                                               SubCmd.Port);
-                                        p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
-                                        return -EINVAL;
-                               }
-
-                               if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) {
-                                        p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
-                                        return -EINVAL;
-                               }
-
-                               if (SubCmd.Host >= p->RIONumHosts ) {
-                                        p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
-                                        return -EINVAL;
-                               }
-
-                               port = p->RIOHosts[SubCmd.Host].
-                                               UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port;
-                               PortP = p->RIOPortp[port];
-
-                               rio_spin_lock_irqsave(&PortP->portSem, flags);
-
-                               if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n");
-                                        rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                                        return -EBUSY;
-                               }
-                               else
-                                        PortP->State |= RIO_BUSY;
-
-                               rio_spin_unlock_irqrestore( &PortP->portSem , flags);
-                               if (copyout((caddr_t)&p->CdRegister, (int)arg, 
-                                                       sizeof(uint)) == COPYFAIL ) {
-                                        rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
-                                        p->RIOError.Error = COPYOUT_FAILED;
-                                        return -EFAULT;
-                               }
-                               return 0;
-                               /*
-                               ** rio_make_dev: given port number (0-511) ORed with port type
-                               ** (RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT) return dev_t
-                               ** value to pass to mknod to create the correct device node.
-                               */
-                       case RIO_MAKE_DEV:
-                               {
-                                       uint port = (uint)arg & RIO_MODEM_MASK;
-
-                                       switch ( (uint)arg & RIO_DEV_MASK ) {
-                                               case RIO_DEV_DIRECT:
-                                                       arg = (caddr_t)drv_makedev(MAJOR(dev), port);
-                                                       rio_dprintk (RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n",port, (int)arg);
-                                                       return (int)arg;
-                                               case RIO_DEV_MODEM:
-                                                       arg =  (caddr_t)drv_makedev(MAJOR(dev), (port|RIO_MODEM_BIT) );
-                                                       rio_dprintk (RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n",port, (int)arg);
-                                                       return (int)arg;
-                                               case RIO_DEV_XPRINT:
-                                                       arg = (caddr_t)drv_makedev(MAJOR(dev), port);
-                                                       rio_dprintk (RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n",port, (int)arg);
-                                                       return (int)arg;
-                                       }
-                                       rio_dprintk (RIO_DEBUG_CTRL, "MAKE Device is called\n");
-                                       return -EINVAL;
-                               }
-                               /*
-                               ** rio_minor: given a dev_t from a stat() call, return
-                               ** the port number (0-511) ORed with the port type
-                               ** ( RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT )
-                               */
-                       case RIO_MINOR:
-                               {
-                                       dev_t dv;
-                                       int mino;
-
-                                       dv = (dev_t)((int)arg);
-                                       mino = RIO_UNMODEM(dv);
+               /*
+                ** It is important that the product code is an unsigned object!
+                */
+               if (DownLoad.ProductCode > MAX_PRODUCT) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode);
+                       p->RIOError.Error = NO_SUCH_PRODUCT;
+                       return -ENXIO;
+               }
+               /*
+                ** do something!
+                */
+               retval = (*(RIOBootTable[DownLoad.ProductCode])) (p, &DownLoad);
+               /* <-- Panic */
+               p->RIOHalted = 0;
+               /*
+                ** and go back, content with a job well completed.
+                */
+               return retval;
+
+       case RIO_PARMS:
+               {
+                       uint host;
+
+                       if (copyin((int) arg, (caddr_t) & host, sizeof(host)) == COPYFAIL) {
+                               rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
+                               p->RIOError.Error = COPYIN_FAILED;
+                               return -EFAULT;
+                       }
+                       /*
+                        ** Fetch the parmmap
+                        */
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n");
+                       if (copyout((caddr_t) p->RIOHosts[host].ParmMapP, (int) arg, sizeof(PARM_MAP)) == COPYFAIL) {
+                               p->RIOError.Error = COPYOUT_FAILED;
+                               rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n");
+                               return -EFAULT;
+                       }
+               }
+               return retval;
+
+       case RIO_HOST_REQ:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n");
+               if (copyin((int) arg, (caddr_t) & HostReq, sizeof(HostReq)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (HostReq.HostNum >= p->RIONumHosts) {
+                       p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", HostReq.HostNum);
+                       return -ENXIO;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum);
+
+               if (copyout((caddr_t) & p->RIOHosts[HostReq.HostNum], (int) HostReq.HostP, sizeof(struct Host)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n");
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_HOST_DPRAM:
+               rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n");
+               if (copyin((int) arg, (caddr_t) & HostDpRam, sizeof(HostDpRam)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (HostDpRam.HostNum >= p->RIONumHosts) {
+                       p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", HostDpRam.HostNum);
+                       return -ENXIO;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum);
+
+               if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) {
+                       int off;
+                       /* It's hardware like this that really gets on my tits. */
+                       static unsigned char copy[sizeof(struct DpRam)];
+                       for (off = 0; off < sizeof(struct DpRam); off++)
+                               copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off];
+                       if (copyout((caddr_t) copy, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) {
+                               p->RIOError.Error = COPYOUT_FAILED;
+                               rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
+                               return -EFAULT;
+                       }
+               } else if (copyout((caddr_t) p->RIOHosts[HostDpRam.HostNum].Caddr, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_SET_BUSY:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n");
+               if ((int) arg < 0 || (int) arg > 511) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n", (int) arg);
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+               p->RIOPortp[(int) arg]->State |= RIO_BUSY;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return retval;
+
+       case RIO_HOST_PORT:
+               /*
+                ** The daemon want port information
+                ** (probably for debug reasons)
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n");
+               if (copyin((int) arg, (caddr_t) & PortReq, sizeof(PortReq)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+
+               if (PortReq.SysPort >= RIO_PORTS) {     /* SysPort is unsigned */
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", PortReq.SysPort);
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort);
+               if (copyout((caddr_t) p->RIOPortp[PortReq.SysPort], (int) PortReq.PortP, sizeof(struct Port)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n");
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_HOST_RUP:
+               /*
+                ** The daemon want rup information
+                ** (probably for debug reasons)
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n");
+               if (copyin((int) arg, (caddr_t) & RupReq, sizeof(RupReq)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", RupReq.HostNum);
+                       p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+               if (RupReq.RupNum >= MAX_RUP + LINKS_PER_UNIT) {        /* eek! */
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", RupReq.RupNum);
+                       p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+               HostP = &p->RIOHosts[RupReq.HostNum];
+
+               if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", RupReq.HostNum);
+                       p->RIOError.Error = HOST_NOT_RUNNING;
+                       return -EIO;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum);
+
+               if (copyout((caddr_t) HostP->UnixRups[RupReq.RupNum].RupP, (int) RupReq.RupP, sizeof(struct RUP)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n");
+                       return -EFAULT;
+               }
+               return retval;
+
+       case RIO_HOST_LPB:
+               /*
+                ** The daemon want lpb information
+                ** (probably for debug reasons)
+                */
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n");
+               if (copyin((int) arg, (caddr_t) & LpbReq, sizeof(LpbReq)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (LpbReq.Host >= p->RIONumHosts) {    /* host is unsigned */
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", LpbReq.Host);
+                       p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+               if (LpbReq.Link >= LINKS_PER_UNIT) {    /* eek! */
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", LpbReq.Link);
+                       p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+               HostP = &p->RIOHosts[LpbReq.Host];
+
+               if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", LpbReq.Host);
+                       p->RIOError.Error = HOST_NOT_RUNNING;
+                       return -EIO;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host);
+
+               if (copyout((caddr_t) & HostP->LinkStrP[LpbReq.Link], (int) LpbReq.LpbP, sizeof(struct LPB)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return retval;
 
-                                       if ( RIO_ISMODEM(dv) ) {
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino);
-                                               arg = (caddr_t)(mino | RIO_DEV_MODEM);
-                                       }
-                                       else {
-                                               rio_dprintk (RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino);
-                                               arg = (caddr_t)(mino | RIO_DEV_DIRECT);
-                                       }
-                                       return (int)arg;
-                               }
+               /*
+                ** Here 3 IOCTL's that allow us to change the way in which
+                ** rio logs errors. send them just to syslog or send them
+                ** to both syslog and console or send them to just the console.
+                **
+                ** See RioStrBuf() in util.c for the other half.
+                */
+       case RIO_SYSLOG_ONLY:
+               p->RIOPrintLogState = PRINT_TO_LOG;     /* Just syslog */
+               return 0;
+
+       case RIO_SYSLOG_CONS:
+               p->RIOPrintLogState = PRINT_TO_LOG_CONS;        /* syslog and console */
+               return 0;
+
+       case RIO_CONS_ONLY:
+               p->RIOPrintLogState = PRINT_TO_CONS;    /* Just console */
+               return 0;
+
+       case RIO_SIGNALS_ON:
+               if (p->RIOSignalProcess) {
+                       p->RIOError.Error = SIGNALS_ALREADY_SET;
+                       return -EBUSY;
+               }
+               p->RIOSignalProcess = getpid();
+               p->RIOPrintDisabled = DONT_PRINT;
+               return retval;
+
+       case RIO_SIGNALS_OFF:
+               if (p->RIOSignalProcess != getpid()) {
+                       p->RIOError.Error = NOT_RECEIVING_PROCESS;
+                       return -EPERM;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "Clear signal process to zero\n");
+               p->RIOSignalProcess = 0;
+               return retval;
+
+       case RIO_SET_BYTE_MODE:
+               for (Host = 0; Host < p->RIONumHosts; Host++)
+                       if (p->RIOHosts[Host].Type == RIO_AT)
+                               p->RIOHosts[Host].Mode &= ~WORD_OPERATION;
+               return retval;
+
+       case RIO_SET_WORD_MODE:
+               for (Host = 0; Host < p->RIONumHosts; Host++)
+                       if (p->RIOHosts[Host].Type == RIO_AT)
+                               p->RIOHosts[Host].Mode |= WORD_OPERATION;
+               return retval;
+
+       case RIO_SET_FAST_BUS:
+               for (Host = 0; Host < p->RIONumHosts; Host++)
+                       if (p->RIOHosts[Host].Type == RIO_AT)
+                               p->RIOHosts[Host].Mode |= FAST_AT_BUS;
+               return retval;
+
+       case RIO_SET_SLOW_BUS:
+               for (Host = 0; Host < p->RIONumHosts; Host++)
+                       if (p->RIOHosts[Host].Type == RIO_AT)
+                               p->RIOHosts[Host].Mode &= ~FAST_AT_BUS;
+               return retval;
+
+       case RIO_MAP_B50_TO_50:
+       case RIO_MAP_B50_TO_57600:
+       case RIO_MAP_B110_TO_110:
+       case RIO_MAP_B110_TO_115200:
+               rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n");
+               port = (uint) arg;
+               if (port < 0 || port > 511) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port);
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+               switch (cmd) {
+               case RIO_MAP_B50_TO_50:
+                       p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50;
+                       break;
+               case RIO_MAP_B50_TO_57600:
+                       p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50;
+                       break;
+               case RIO_MAP_B110_TO_110:
+                       p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110;
+                       break;
+               case RIO_MAP_B110_TO_115200:
+                       p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110;
+                       break;
+               }
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return retval;
+
+       case RIO_STREAM_INFO:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n");
+               return -EINVAL;
+
+       case RIO_SEND_PACKET:
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n");
+               if (copyin((int) arg, (caddr_t) & SendPack, sizeof(SendPack)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               if (SendPack.PortNum >= 128) {
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -ENXIO;
+               }
+
+               PortP = p->RIOPortp[SendPack.PortNum];
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+
+               if (!can_add_transmit(&PacketP, PortP)) {
+                       p->RIOError.Error = UNIT_IS_IN_USE;
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                       return -ENOSPC;
+               }
+
+               for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++)
+                       WBYTE(PacketP->data[loop], SendPack.Data[loop]);
+
+               WBYTE(PacketP->len, SendPack.Len);
+
+               add_transmit(PortP);
+               /*
+                ** Count characters transmitted for port statistics reporting
+                */
+               if (PortP->statsGather)
+                       PortP->txchars += (SendPack.Len & 127);
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return retval;
+
+       case RIO_NO_MESG:
+               if (su)
+                       p->RIONoMessage = 1;
+               return su ? 0 : -EPERM;
+
+       case RIO_MESG:
+               if (su)
+                       p->RIONoMessage = 0;
+               return su ? 0 : -EPERM;
+
+       case RIO_WHAT_MESG:
+               if (copyout((caddr_t) & p->RIONoMessage, (int) arg, sizeof(p->RIONoMessage)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return 0;
+
+       case RIO_MEM_DUMP:
+               if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Addr);
+
+               if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) {
+                       p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+
+               if (SubCmd.Host >= p->RIONumHosts) {
+                       p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+
+               port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort;
+
+               PortP = p->RIOPortp[port];
+
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+
+               if (RIOPreemptiveCmd(p, PortP, MEMDUMP) == RIO_FAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n");
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                       return -EBUSY;
+               } else
+                       PortP->State |= RIO_BUSY;
+
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               if (copyout((caddr_t) p->RIOMemDump, (int) arg, MEMDUMP_SIZE) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return 0;
+
+       case RIO_TICK:
+               if ((int) arg < 0 || (int) arg >= p->RIONumHosts)
+                       return -EINVAL;
+               rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int) arg);
+               WBYTE(p->RIOHosts[(int) arg].SetInt, 0xff);
+               return 0;
+
+       case RIO_TOCK:
+               if ((int) arg < 0 || (int) arg >= p->RIONumHosts)
+                       return -EINVAL;
+               rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int) arg);
+               WBYTE((p->RIOHosts[(int) arg].ResetInt), 0xff);
+               return 0;
+
+       case RIO_READ_CHECK:
+               /* Check reads for pkts with data[0] the same */
+               p->RIOReadCheck = !p->RIOReadCheck;
+               if (copyout((caddr_t) & p->RIOReadCheck, (int) arg, sizeof(uint)) == COPYFAIL) {
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return 0;
+
+       case RIO_READ_REGISTER:
+               if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) {
+                       p->RIOError.Error = COPYIN_FAILED;
+                       return -EFAULT;
+               }
+               rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr);
+
+               if (SubCmd.Port > 511) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", SubCmd.Port);
+                       p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+
+               if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) {
+                       p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+
+               if (SubCmd.Host >= p->RIONumHosts) {
+                       p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
+                       return -EINVAL;
+               }
+
+               port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port;
+               PortP = p->RIOPortp[port];
+
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
+
+               if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n");
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                       return -EBUSY;
+               } else
+                       PortP->State |= RIO_BUSY;
+
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               if (copyout((caddr_t) & p->CdRegister, (int) arg, sizeof(uint)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
+                       p->RIOError.Error = COPYOUT_FAILED;
+                       return -EFAULT;
+               }
+               return 0;
+               /*
+                ** rio_make_dev: given port number (0-511) ORed with port type
+                ** (RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT) return dev_t
+                ** value to pass to mknod to create the correct device node.
+                */
+       case RIO_MAKE_DEV:
+               {
+                       uint port = (uint) arg & RIO_MODEM_MASK;
+
+                       switch ((uint) arg & RIO_DEV_MASK) {
+                       case RIO_DEV_DIRECT:
+                               arg = (caddr_t) drv_makedev(MAJOR(dev), port);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, (int) arg);
+                               return (int) arg;
+                       case RIO_DEV_MODEM:
+                               arg = (caddr_t) drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT));
+                               rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, (int) arg);
+                               return (int) arg;
+                       case RIO_DEV_XPRINT:
+                               arg = (caddr_t) drv_makedev(MAJOR(dev), port);
+                               rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, (int) arg);
+                               return (int) arg;
+                       }
+                       rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n");
+                       return -EINVAL;
+               }
+               /*
+                ** rio_minor: given a dev_t from a stat() call, return
+                ** the port number (0-511) ORed with the port type
+                ** ( RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT )
+                */
+       case RIO_MINOR:
+               {
+                       dev_t dv;
+                       int mino;
+
+                       dv = (dev_t) ((int) arg);
+                       mino = RIO_UNMODEM(dv);
+
+                       if (RIO_ISMODEM(dv)) {
+                               rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino);
+                               arg = (caddr_t) (mino | RIO_DEV_MODEM);
+                       } else {
+                               rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino);
+                               arg = (caddr_t) (mino | RIO_DEV_DIRECT);
+                       }
+                       return (int) arg;
+               }
        }
-       rio_dprintk (RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n",cmd);
+       rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd);
        p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
 
-       func_exit ();
+       func_exit();
        return -EINVAL;
 }
 
 /*
 ** Pre-emptive commands go on RUPs and are only one byte long.
 */
-int
-RIOPreemptiveCmd(p, PortP, Cmd)
-struct rio_info *      p;
+int RIOPreemptiveCmd(p, PortP, Cmd)
+struct rio_info *p;
 struct Port *PortP;
 uchar Cmd;
 {
@@ -1766,104 +1654,99 @@ uchar Cmd;
        int port;
 
 #ifdef CHECK
-       CheckPortP( PortP );
+       CheckPortP(PortP);
 #endif
 
-       if ( PortP->State & RIO_DELETED ) {
-               rio_dprintk (RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n");
+       if (PortP->State & RIO_DELETED) {
+               rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n");
                return RIO_FAIL;
        }
 
-       if (((int)((char)PortP->InUse) == -1) || ! (CmdBlkP = RIOGetCmdBlk()) ) {
-               rio_dprintk (RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n",
-                      Cmd, PortP->PortNum);
+       if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) {
+               rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum);
                return RIO_FAIL;
        }
 
-       rio_dprintk (RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", 
-              (int)CmdBlkP,PortP->InUse);
+       rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", (int) CmdBlkP, PortP->InUse);
 
-       PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0];
+       PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0];
 
-       CmdBlkP->Packet.src_unit  = 0;
+       CmdBlkP->Packet.src_unit = 0;
        if (PortP->SecondBlock)
                rup = PortP->ID2;
        else
                rup = PortP->RupNum;
        CmdBlkP->Packet.dest_unit = rup;
-       CmdBlkP->Packet.src_port  = COMMAND_RUP;
+       CmdBlkP->Packet.src_port = COMMAND_RUP;
        CmdBlkP->Packet.dest_port = COMMAND_RUP;
-       CmdBlkP->Packet.len       = PKT_CMD_BIT | 2;
-       CmdBlkP->PostFuncP      = RIOUnUse;
-       CmdBlkP->PostArg        = (int)PortP;
-       PktCmdP->Command        = Cmd;
-       port                            = PortP->HostPort % (ushort)PORTS_PER_RTA;
+       CmdBlkP->Packet.len = PKT_CMD_BIT | 2;
+       CmdBlkP->PostFuncP = RIOUnUse;
+       CmdBlkP->PostArg = (int) PortP;
+       PktCmdP->Command = Cmd;
+       port = PortP->HostPort % (ushort) PORTS_PER_RTA;
        /*
-       ** Index ports 8-15 for 2nd block of 16 port RTA.
-       */
+        ** Index ports 8-15 for 2nd block of 16 port RTA.
+        */
        if (PortP->SecondBlock)
                port += (ushort) PORTS_PER_RTA;
-       PktCmdP->PhbNum    = port;
-
-       switch ( Cmd ) {
-               case MEMDUMP:
-                       rio_dprintk (RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n",
-                              (int)CmdBlkP, (int)SubCmd.Addr);
-                       PktCmdP->SubCommand             = MEMDUMP;
-                       PktCmdP->SubAddr                = SubCmd.Addr;
-                       break;
-               case FCLOSE:
-                       rio_dprintk (RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n",(int)CmdBlkP);
-                       break;
-               case READ_REGISTER:
-                       rio_dprintk (RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n",
-                               (int)SubCmd.Addr, (int)CmdBlkP);
-                       PktCmdP->SubCommand             = READ_REGISTER;
-                       PktCmdP->SubAddr                = SubCmd.Addr;
-                       break;
-               case RESUME:
-                       rio_dprintk (RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n",(int)CmdBlkP);
-                       break;
-               case RFLUSH:
-                       rio_dprintk (RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n",(int)CmdBlkP);
-                       CmdBlkP->PostFuncP = RIORFlushEnable;
-                       break;
-               case SUSPEND:
-                       rio_dprintk (RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n",(int)CmdBlkP);
-                       break;
-
-               case MGET :
-                       rio_dprintk (RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int)CmdBlkP);
-                       break;
-
-               case MSET :
-               case MBIC :
-               case MBIS :
-                       CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;
-                       rio_dprintk (RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int)CmdBlkP);
-                       break;
-
-               case WFLUSH:
-                       /*
-                       ** If we have queued up the maximum number of Write flushes
-                       ** allowed then we should not bother sending any more to the
-                       ** RTA.
-                       */
-                       if ((int)((char)PortP->WflushFlag) == (int)-1) {
-                               rio_dprintk (RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!");
-                               RIOFreeCmdBlk(CmdBlkP);
-                               return(RIO_FAIL);
-                       } else {
-                               rio_dprintk (RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n",
-                                      (int)CmdBlkP);
-                               CmdBlkP->PostFuncP = RIOWFlushMark;
-                       }
-                       break;
+       PktCmdP->PhbNum = port;
+
+       switch (Cmd) {
+       case MEMDUMP:
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", (int) CmdBlkP, (int) SubCmd.Addr);
+               PktCmdP->SubCommand = MEMDUMP;
+               PktCmdP->SubAddr = SubCmd.Addr;
+               break;
+       case FCLOSE:
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n", (int) CmdBlkP);
+               break;
+       case READ_REGISTER:
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", (int) SubCmd.Addr, (int) CmdBlkP);
+               PktCmdP->SubCommand = READ_REGISTER;
+               PktCmdP->SubAddr = SubCmd.Addr;
+               break;
+       case RESUME:
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n", (int) CmdBlkP);
+               break;
+       case RFLUSH:
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n", (int) CmdBlkP);
+               CmdBlkP->PostFuncP = RIORFlushEnable;
+               break;
+       case SUSPEND:
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n", (int) CmdBlkP);
+               break;
+
+       case MGET:
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int) CmdBlkP);
+               break;
+
+       case MSET:
+       case MBIC:
+       case MBIS:
+               CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;
+               rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int) CmdBlkP);
+               break;
+
+       case WFLUSH:
+               /*
+                ** If we have queued up the maximum number of Write flushes
+                ** allowed then we should not bother sending any more to the
+                ** RTA.
+                */
+               if ((int) ((char) PortP->WflushFlag) == (int) -1) {
+                       rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!");
+                       RIOFreeCmdBlk(CmdBlkP);
+                       return (RIO_FAIL);
+               } else {
+                       rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", (int) CmdBlkP);
+                       CmdBlkP->PostFuncP = RIOWFlushMark;
+               }
+               break;
        }
 
        PortP->InUse++;
 
-       Ret = RIOQueueCmdBlk( PortP->HostP, rup, CmdBlkP );
+       Ret = RIOQueueCmdBlk(PortP->HostP, rup, CmdBlkP);
 
        return Ret;
 }
index bc38ac5dfbdef05928dc0179a0020fe5b02f305e..663ee0914ed789720d4f0f17f82e3511e41e447b 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef __riodrvr_h
 #define __riodrvr_h
 
-#include <asm/param.h> /* for HZ */
+#include <asm/param.h>         /* for HZ */
 
 #ifdef SCCS_LABELS
 static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h 1.3";
@@ -44,15 +44,15 @@ static char *_riodrvr_h_sccs_ = "@(#)riodrvr.h      1.3";
 
 
 struct rio_info {
-       int                     mode;                   /* Intr or polled, word/byte */
-       spinlock_t              RIOIntrSem;             /* Interrupt thread sem */
-       int                     current_chan;           /* current channel */
-       int                     RIOFailed;              /* Not initialised ? */
-       int                     RIOInstallAttempts;     /* no. of rio-install() calls */
-       int                     RIOLastPCISearch;       /* status of last search */
-       int                     RIONumHosts;            /* Number of RIO Hosts */
-       struct Host             * RIOHosts;             /* RIO Host values */
-       struct Port             **RIOPortp;             /* RIO port values */
+       int mode;               /* Intr or polled, word/byte */
+       spinlock_t RIOIntrSem;  /* Interrupt thread sem */
+       int current_chan;       /* current channel */
+       int RIOFailed;          /* Not initialised ? */
+       int RIOInstallAttempts; /* no. of rio-install() calls */
+       int RIOLastPCISearch;   /* status of last search */
+       int RIONumHosts;        /* Number of RIO Hosts */
+       struct Host *RIOHosts;  /* RIO Host values */
+       struct Port **RIOPortp; /* RIO port values */
 /*
 ** 02.03.1999 ARG - ESIL 0820 fix
 ** We no longer use RIOBootMode
@@ -60,9 +60,9 @@ struct rio_info {
        int                     RIOBootMode;            * RIO boot mode *
 **
 */
-       int                     RIOPrintDisabled;       /* RIO printing disabled ? */
-       int                     RIOPrintLogState;       /* RIO printing state ? */
-       int                     RIOPolling;             /* Polling ? */
+       int RIOPrintDisabled;   /* RIO printing disabled ? */
+       int RIOPrintLogState;   /* RIO printing state ? */
+       int RIOPolling;         /* Polling ? */
 /*
 ** 09.12.1998 ARG - ESIL 0776 part fix
 ** The 'RIO_QUICK_CHECK' ioctl was using RIOHalted.
@@ -70,61 +70,61 @@ struct rio_info {
 ** updated in RIOConCon() - to keep track of RTA connections/disconnections.
 ** 'RIO_QUICK_CHECK' now returns the value of RIORtaDisCons.
 */
-       int                     RIOHalted;              /* halted ? */
-       int                     RIORtaDisCons;          /* RTA connections/disconnections */
-       uint                    RIOReadCheck;           /* Rio read check */
-       uint                    RIONoMessage;           /* To display message or not */
-       uint                    RIONumBootPkts;         /* how many packets for an RTA */
-       uint                    RIOBootCount;           /* size of RTA code */
-       uint                    RIOBooting;             /* count of outstanding boots */
-       uint                    RIOSystemUp;            /* Booted ?? */
-       uint                    RIOCounting;            /* for counting interrupts */
-       uint                    RIOIntCount;            /* # of intr since last check */
-       uint                    RIOTxCount;             /* number of xmit intrs  */
-       uint                    RIORxCount;             /* number of rx intrs */
-       uint                    RIORupCount;            /* number of rup intrs */
-       int                     RIXTimer; 
-       int                     RIOBufferSize;          /* Buffersize */
-       int                     RIOBufferMask;          /* Buffersize */
-
-       int                     RIOFirstMajor;          /* First host card's major no */
-
-       uint                    RIOLastPortsMapped;     /* highest port number known */
-       uint                    RIOFirstPortsMapped;    /* lowest port number known */
-
-       uint                    RIOLastPortsBooted;     /* highest port number running */
-       uint                    RIOFirstPortsBooted;    /* lowest port number running */
-
-       uint                    RIOLastPortsOpened;     /* highest port number running */
-       uint                    RIOFirstPortsOpened;    /* lowest port number running */
+       int RIOHalted;          /* halted ? */
+       int RIORtaDisCons;      /* RTA connections/disconnections */
+       uint RIOReadCheck;      /* Rio read check */
+       uint RIONoMessage;      /* To display message or not */
+       uint RIONumBootPkts;    /* how many packets for an RTA */
+       uint RIOBootCount;      /* size of RTA code */
+       uint RIOBooting;        /* count of outstanding boots */
+       uint RIOSystemUp;       /* Booted ?? */
+       uint RIOCounting;       /* for counting interrupts */
+       uint RIOIntCount;       /* # of intr since last check */
+       uint RIOTxCount;        /* number of xmit intrs  */
+       uint RIORxCount;        /* number of rx intrs */
+       uint RIORupCount;       /* number of rup intrs */
+       int RIXTimer;
+       int RIOBufferSize;      /* Buffersize */
+       int RIOBufferMask;      /* Buffersize */
+
+       int RIOFirstMajor;      /* First host card's major no */
+
+       uint RIOLastPortsMapped;        /* highest port number known */
+       uint RIOFirstPortsMapped;       /* lowest port number known */
+
+       uint RIOLastPortsBooted;        /* highest port number running */
+       uint RIOFirstPortsBooted;       /* lowest port number running */
+
+       uint RIOLastPortsOpened;        /* highest port number running */
+       uint RIOFirstPortsOpened;       /* lowest port number running */
 
        /* Flag to say that the topology information has been changed. */
-       uint                    RIOQuickCheck; 
-       uint                    CdRegister;             /* ??? */
-       int                     RIOSignalProcess;       /* Signalling process */
-       int                     rio_debug;              /* To debug ... */
-       int                     RIODebugWait;           /* For what ??? */
-       int                     tpri;                   /* Thread prio */
-       int                     tid;                    /* Thread id */
-       uint                    _RIO_Polled;            /* Counter for polling */
-       uint                    _RIO_Interrupted;       /* Counter for interrupt */
-       int                     intr_tid;               /* iointset return value */
-       int                     TxEnSem;                /* TxEnable Semaphore */
-
-
-       struct Error            RIOError;               /* to Identify what went wrong */ 
-       struct Conf             RIOConf;                /* Configuration ??? */
-       struct ttystatics       channel[RIO_PORTS];     /* channel information */
-       char                    RIOBootPackets[1+(SIXTY_FOUR_K/RTA_BOOT_DATA_SIZE)]
-                                                               [RTA_BOOT_DATA_SIZE];
-       struct Map              RIOConnectTable[TOTAL_MAP_ENTRIES];
-       struct Map              RIOSavedTable[TOTAL_MAP_ENTRIES];
+       uint RIOQuickCheck;
+       uint CdRegister;        /* ??? */
+       int RIOSignalProcess;   /* Signalling process */
+       int rio_debug;          /* To debug ... */
+       int RIODebugWait;       /* For what ??? */
+       int tpri;               /* Thread prio */
+       int tid;                /* Thread id */
+       uint _RIO_Polled;       /* Counter for polling */
+       uint _RIO_Interrupted;  /* Counter for interrupt */
+       int intr_tid;           /* iointset return value */
+       int TxEnSem;            /* TxEnable Semaphore */
+
+
+       struct Error RIOError;  /* to Identify what went wrong */
+       struct Conf RIOConf;    /* Configuration ??? */
+       struct ttystatics channel[RIO_PORTS];   /* channel information */
+       char RIOBootPackets[1 + (SIXTY_FOUR_K / RTA_BOOT_DATA_SIZE)]
+           [RTA_BOOT_DATA_SIZE];
+       struct Map RIOConnectTable[TOTAL_MAP_ENTRIES];
+       struct Map RIOSavedTable[TOTAL_MAP_ENTRIES];
 
        /* RTA to host binding table for master/slave operation */
-       ulong                   RIOBindTab[MAX_RTA_BINDINGS];
+       ulong RIOBindTab[MAX_RTA_BINDINGS];
        /* RTA memory dump variable */
-       uchar                   RIOMemDump[MEMDUMP_SIZE]; 
-       struct ModuleInfo       RIOModuleTypes[MAX_MODULE_TYPES];
+       uchar RIOMemDump[MEMDUMP_SIZE];
+       struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES];
 
 };
 
@@ -141,4 +141,4 @@ struct rio_info {
 #define WRBYTE(x,y)            *(volatile unsigned char *)((x)) = \
                                        (unsigned char)(y)
 
-#endif /* __riodrvr.h */
+#endif                         /* __riodrvr.h */
index e08421c9558e488a5a03ccc911e702192bd8891a..8de7966e603a6070d51b81ca4d2289826d34fbff 100644 (file)
@@ -41,29 +41,29 @@ static char *_rioinfo_h_sccs_ = "@(#)rioinfo.h      1.2";
 ** Host card data structure
 */
 struct RioHostInfo {
-       long    location;       /* RIO Card Base I/O address */
-       long    vector;         /* RIO Card IRQ vector */
-       int     bus;            /* ISA/EISA/MCA/PCI */
-       int     mode;           /* pointer to host mode - INTERRUPT / POLLED */
+       long location;          /* RIO Card Base I/O address */
+       long vector;            /* RIO Card IRQ vector */
+       int bus;                /* ISA/EISA/MCA/PCI */
+       int mode;               /* pointer to host mode - INTERRUPT / POLLED */
        struct old_sgttyb
-               * Sg;           /* pointer to default term characteristics */
+       *Sg;                    /* pointer to default term characteristics */
 };
 
 
 /* Mode in rio device info */
-#define INTERRUPTED_MODE       0x01            /* Interrupt is generated */
-#define POLLED_MODE            0x02            /* No interrupt */
-#define AUTO_MODE              0x03            /* Auto mode */
+#define INTERRUPTED_MODE       0x01    /* Interrupt is generated */
+#define POLLED_MODE            0x02    /* No interrupt */
+#define AUTO_MODE              0x03    /* Auto mode */
 
-#define WORD_ACCESS_MODE       0x10            /* Word Access Mode */
-#define BYTE_ACCESS_MODE       0x20            /* Byte Access Mode */
+#define WORD_ACCESS_MODE       0x10    /* Word Access Mode */
+#define BYTE_ACCESS_MODE       0x20    /* Byte Access Mode */
 
 
 /* Bus type that RIO supports */
-#define ISA_BUS                        0x01            /* The card is ISA */
-#define EISA_BUS               0x02            /* The card is EISA */
-#define MCA_BUS                        0x04            /* The card is MCA */
-#define PCI_BUS                        0x08            /* The card is PCI */
+#define ISA_BUS                        0x01    /* The card is ISA */
+#define EISA_BUS               0x02    /* The card is EISA */
+#define MCA_BUS                        0x04    /* The card is MCA */
+#define PCI_BUS                        0x08    /* The card is PCI */
 
 /*
 ** 11.11.1998 ARG - ESIL ???? part fix
@@ -93,4 +93,4 @@ struct RioHostInfo {
        'V' - '@'                               /* literal next char */ \
 }
 
-#endif /* __rioinfo_h */
+#endif                         /* __rioinfo_h */
index ddda9c14e0590277984f5234edfd5291b7ebef5f..34d8787557a1414237b4c6cb3286cb27271031f3 100644 (file)
@@ -88,99 +88,93 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c      1.2";
 static void RIOReceive(struct rio_info *, struct Port *);
 
 
-static char *firstchars (char *p, int nch)
+static char *firstchars(char *p, int nch)
 {
-  static char buf[2][128];
-  static int t=0;
-  t = ! t;
-  memcpy (buf[t], p, nch);
-  buf[t][nch] = 0;
-  return buf[t];
+       static char buf[2][128];
+       static int t = 0;
+       t = !t;
+       memcpy(buf[t], p, nch);
+       buf[t][nch] = 0;
+       return buf[t];
 }
 
 
 #define        INCR( P, I )    ((P) = (((P)+(I)) & p->RIOBufferMask))
 /* Enable and start the transmission of packets */
-void
-RIOTxEnable(en)
-char *         en;
+void RIOTxEnable(en)
+char *en;
 {
-  struct Port *        PortP;
-  struct rio_info *p;
-  struct tty_struct* tty;
-  int c;
-  struct PKT * PacketP;
-  unsigned long flags;
-
-  PortP = (struct Port *)en; 
-  p = (struct rio_info *)PortP->p;
-  tty = PortP->gs.tty;
-
-
-  rio_dprintk (RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", 
-             PortP->PortNum, PortP->gs.xmit_cnt);
-
-  if (!PortP->gs.xmit_cnt) return;
-  
-
-  /* This routine is an order of magnitude simpler than the specialix
-     version. One of the disadvantages is that this version will send
-     an incomplete packet (usually 64 bytes instead of 72) once for
-     every 4k worth of data. Let's just say that this won't influence
-     performance significantly..... */
-
-  rio_spin_lock_irqsave(&PortP->portSem, flags);
-
-  while (can_add_transmit( &PacketP, PortP )) {
-    c = PortP->gs.xmit_cnt;
-    if (c > PKT_MAX_DATA_LEN) c = PKT_MAX_DATA_LEN;
-
-    /* Don't copy past the end of the source buffer */
-    if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail) 
-      c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail;
-
-    { int t;
-    t = (c > 10)?10:c;
-    
-    rio_dprintk (RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", 
-                PortP->PortNum, c, 
-                firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail      , t),
-                firstchars (PortP->gs.xmit_buf + PortP->gs.xmit_tail + c-t, t));
-    }
-    /* If for one reason or another, we can't copy more data, 
-       we're done! */
-    if (c == 0) break;
-
-    rio_memcpy_toio (PortP->HostP->Caddr, (caddr_t)PacketP->data, 
-                PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
-    /*    udelay (1); */
-
-    writeb (c, &(PacketP->len));
-    if (!( PortP->State & RIO_DELETED ) ) {
-      add_transmit ( PortP );
-      /*
-      ** Count chars tx'd for port statistics reporting
-      */
-      if ( PortP->statsGather )
-       PortP->txchars += c;
-    }
-    PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE-1);
-    PortP->gs.xmit_cnt -= c;
-  }
-
-  rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-
-  if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2*PKT_MAX_DATA_LEN)) {
-    rio_dprintk (RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....",
-                (int)(PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)),
-                PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); 
-    if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
-       PortP->gs.tty->ldisc.write_wakeup)
-      (PortP->gs.tty->ldisc.write_wakeup)(PortP->gs.tty);
-    rio_dprintk (RIO_DEBUG_INTR, "(%d/%d)\n",
-               PortP->gs.wakeup_chars, PortP->gs.xmit_cnt); 
-    wake_up_interruptible(&PortP->gs.tty->write_wait);
-  }
+       struct Port *PortP;
+       struct rio_info *p;
+       struct tty_struct *tty;
+       int c;
+       struct PKT *PacketP;
+       unsigned long flags;
+
+       PortP = (struct Port *) en;
+       p = (struct rio_info *) PortP->p;
+       tty = PortP->gs.tty;
+
+
+       rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt);
+
+       if (!PortP->gs.xmit_cnt)
+               return;
+
+
+       /* This routine is an order of magnitude simpler than the specialix
+          version. One of the disadvantages is that this version will send
+          an incomplete packet (usually 64 bytes instead of 72) once for
+          every 4k worth of data. Let's just say that this won't influence
+          performance significantly..... */
+
+       rio_spin_lock_irqsave(&PortP->portSem, flags);
+
+       while (can_add_transmit(&PacketP, PortP)) {
+               c = PortP->gs.xmit_cnt;
+               if (c > PKT_MAX_DATA_LEN)
+                       c = PKT_MAX_DATA_LEN;
+
+               /* Don't copy past the end of the source buffer */
+               if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail)
+                       c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail;
+
+               {
+                       int t;
+                       t = (c > 10) ? 10 : c;
+
+                       rio_dprintk(RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", PortP->PortNum, c, firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail, t), firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail + c - t, t));
+               }
+               /* If for one reason or another, we can't copy more data,
+                  we're done! */
+               if (c == 0)
+                       break;
+
+               rio_memcpy_toio(PortP->HostP->Caddr, (caddr_t) PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
+               /*    udelay (1); */
+
+               writeb(c, &(PacketP->len));
+               if (!(PortP->State & RIO_DELETED)) {
+                       add_transmit(PortP);
+                       /*
+                        ** Count chars tx'd for port statistics reporting
+                        */
+                       if (PortP->statsGather)
+                               PortP->txchars += c;
+               }
+               PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE - 1);
+               PortP->gs.xmit_cnt -= c;
+       }
+
+       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+
+       if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) {
+               rio_dprintk(RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", (int) (PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
+               if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && PortP->gs.tty->ldisc.write_wakeup)
+                       (PortP->gs.tty->ldisc.write_wakeup) (PortP->gs.tty);
+               rio_dprintk(RIO_DEBUG_INTR, "(%d/%d)\n", PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
+               wake_up_interruptible(&PortP->gs.tty->write_wait);
+       }
 
 }
 
@@ -189,361 +183,349 @@ char *          en;
 ** RIO Host Service routine. Does all the work traditionally associated with an
 ** interrupt.
 */
-static int     RupIntr;
-static int     RxIntr;
-static int     TxIntr;
-void
-RIOServiceHost(p, HostP, From)
-struct rio_info *      p;
+static int RupIntr;
+static int RxIntr;
+static int TxIntr;
+void RIOServiceHost(p, HostP, From)
+struct rio_info *p;
 struct Host *HostP;
-int From; 
+int From;
 {
-  rio_spin_lock (&HostP->HostLock);
-  if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) { 
-    static int t =0;
-    rio_spin_unlock (&HostP->HostLock); 
-    if ((t++ % 200) == 0)
-      rio_dprintk (RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int)HostP->Flags);
-    return;
-  }
-  rio_spin_unlock (&HostP->HostLock); 
-
-  if ( RWORD( HostP->ParmMapP->rup_intr ) ) {
-    WWORD( HostP->ParmMapP->rup_intr , 0 );
-    p->RIORupCount++;
-    RupIntr++;
-    rio_dprintk (RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP-p->RIOHosts);
-    RIOPollHostCommands(p, HostP );
-  }
-
-  if ( RWORD( HostP->ParmMapP->rx_intr ) ) {
-    int port;
-
-    WWORD( HostP->ParmMapP->rx_intr , 0 );
-    p->RIORxCount++;
-    RxIntr++;
-
-    rio_dprintk (RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP-p->RIOHosts);
-    /*
-    ** Loop through every port. If the port is mapped into
-    ** the system ( i.e. has /dev/ttyXXXX associated ) then it is
-    ** worth checking. If the port isn't open, grab any packets
-    ** hanging on its receive queue and stuff them on the free
-    ** list; check for commands on the way.
-    */
-    for ( port=p->RIOFirstPortsBooted; 
-         port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) {
-      struct Port *PortP = p->RIOPortp[port];
-      struct tty_struct *ttyP;
-      struct PKT *PacketP;
-               
-      /*
-      ** not mapped in - most of the RIOPortp[] information
-      ** has not been set up!
-      ** Optimise: ports come in bundles of eight.
-      */
-      if ( !PortP->Mapped ) {
-       port += 7;
-       continue; /* with the next port */
-      }
-
-      /*
-      ** If the host board isn't THIS host board, check the next one.
-      ** optimise: ports come in bundles of eight.
-      */
-      if ( PortP->HostP != HostP ) {
-       port += 7;
-       continue;
-      }
-
-      /*
-      ** Let us see - is the port open? If not, then don't service it.
-      */
-      if ( !( PortP->PortState & PORT_ISOPEN ) ) {
-       continue;
-      }
-
-      /*
-      ** find corresponding tty structure. The process of mapping
-      ** the ports puts these here.
-      */
-      ttyP = PortP->gs.tty;
-
-      /*
-      ** Lock the port before we begin working on it.
-      */
-      rio_spin_lock(&PortP->portSem);
-
-      /*
-      ** Process received data if there is any.
-      */
-      if ( can_remove_receive( &PacketP, PortP ) )
-       RIOReceive(p, PortP);
-
-      /*
-      ** If there is no data left to be read from the port, and
-      ** it's handshake bit is set, then we must clear the handshake,
-      ** so that that downstream RTA is re-enabled.
-      */
-      if ( !can_remove_receive( &PacketP, PortP ) && 
-          ( RWORD( PortP->PhbP->handshake )==PHB_HANDSHAKE_SET ) ) {
+       rio_spin_lock(&HostP->HostLock);
+       if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
+               static int t = 0;
+               rio_spin_unlock(&HostP->HostLock);
+               if ((t++ % 200) == 0)
+                       rio_dprintk(RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int) HostP->Flags);
+               return;
+       }
+       rio_spin_unlock(&HostP->HostLock);
+
+       if (RWORD(HostP->ParmMapP->rup_intr)) {
+               WWORD(HostP->ParmMapP->rup_intr, 0);
+               p->RIORupCount++;
+               RupIntr++;
+               rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP - p->RIOHosts);
+               RIOPollHostCommands(p, HostP);
+       }
+
+       if (RWORD(HostP->ParmMapP->rx_intr)) {
+               int port;
+
+               WWORD(HostP->ParmMapP->rx_intr, 0);
+               p->RIORxCount++;
+               RxIntr++;
+
+               rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP - p->RIOHosts);
+               /*
+                ** Loop through every port. If the port is mapped into
+                ** the system ( i.e. has /dev/ttyXXXX associated ) then it is
+                ** worth checking. If the port isn't open, grab any packets
+                ** hanging on its receive queue and stuff them on the free
+                ** list; check for commands on the way.
+                */
+               for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
+                       struct Port *PortP = p->RIOPortp[port];
+                       struct tty_struct *ttyP;
+                       struct PKT *PacketP;
+
+                       /*
+                        ** not mapped in - most of the RIOPortp[] information
+                        ** has not been set up!
+                        ** Optimise: ports come in bundles of eight.
+                        */
+                       if (!PortP->Mapped) {
+                               port += 7;
+                               continue;       /* with the next port */
+                       }
+
+                       /*
+                        ** If the host board isn't THIS host board, check the next one.
+                        ** optimise: ports come in bundles of eight.
+                        */
+                       if (PortP->HostP != HostP) {
+                               port += 7;
+                               continue;
+                       }
+
+                       /*
+                        ** Let us see - is the port open? If not, then don't service it.
+                        */
+                       if (!(PortP->PortState & PORT_ISOPEN)) {
+                               continue;
+                       }
+
+                       /*
+                        ** find corresponding tty structure. The process of mapping
+                        ** the ports puts these here.
+                        */
+                       ttyP = PortP->gs.tty;
+
+                       /*
+                        ** Lock the port before we begin working on it.
+                        */
+                       rio_spin_lock(&PortP->portSem);
+
+                       /*
+                        ** Process received data if there is any.
+                        */
+                       if (can_remove_receive(&PacketP, PortP))
+                               RIOReceive(p, PortP);
+
+                       /*
+                        ** If there is no data left to be read from the port, and
+                        ** it's handshake bit is set, then we must clear the handshake,
+                        ** so that that downstream RTA is re-enabled.
+                        */
+                       if (!can_remove_receive(&PacketP, PortP) && (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) {
                                /*
-                               ** MAGIC! ( Basically, handshake the RX buffer, so that
-                               ** the RTAs upstream can be re-enabled. )
-                               */
-       rio_dprintk (RIO_DEBUG_INTR, "Set RX handshake bit\n");
-       WWORD( PortP->PhbP->handshake, 
-              PHB_HANDSHAKE_SET|PHB_HANDSHAKE_RESET );
-      }
-      rio_spin_unlock(&PortP->portSem);
-    }
-  }
-
-  if ( RWORD( HostP->ParmMapP->tx_intr ) ) {
-    int port;
-
-    WWORD( HostP->ParmMapP->tx_intr , 0);
-
-    p->RIOTxCount++;
-    TxIntr++;
-    rio_dprintk (RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP-p->RIOHosts);
-
-    /*
-    ** Loop through every port.
-    ** If the port is mapped into the system ( i.e. has /dev/ttyXXXX
-    ** associated ) then it is worth checking.
-    */
-    for ( port=p->RIOFirstPortsBooted; 
-         port<p->RIOLastPortsBooted+PORTS_PER_RTA; port++ ) {
-      struct Port *PortP = p->RIOPortp[port];
-      struct tty_struct *ttyP;
-      struct PKT *PacketP;
-
-      /*
-      ** not mapped in - most of the RIOPortp[] information
-      ** has not been set up!
-      */
-      if ( !PortP->Mapped ) {
-       port += 7;
-       continue; /* with the next port */
-      }
-
-      /*
-      ** If the host board isn't running, then its data structures
-      ** are no use to us - continue quietly.
-      */
-      if ( PortP->HostP != HostP ) {
-       port += 7;
-       continue; /* with the next port */
-      }
-
-      /*
-      ** Let us see - is the port open? If not, then don't service it.
-      */
-      if ( !( PortP->PortState & PORT_ISOPEN ) ) {
-       continue;
-      }
-
-      rio_dprintk (RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port);
-      /*
-      ** Lock the port before we begin working on it.
-      */
-      rio_spin_lock(&PortP->portSem);
-
-      /*
-      ** If we can't add anything to the transmit queue, then
-      ** we need do none of this processing.
-      */
-      if ( !can_add_transmit( &PacketP, PortP ) ) {
-       rio_dprintk (RIO_DEBUG_INTR, "Can't add to port, so skipping.\n");
-       rio_spin_unlock(&PortP->portSem);
-       continue;
-      }
-
-      /*
-      ** find corresponding tty structure. The process of mapping
-      ** the ports puts these here.
-      */
-      ttyP = PortP->gs.tty;
-      /* If ttyP is NULL, the port is getting closed. Forget about it. */
-      if (!ttyP) {
-       rio_dprintk (RIO_DEBUG_INTR, "no tty, so skipping.\n");
-       rio_spin_unlock(&PortP->portSem);
-       continue;
-      }
-      /*
-      ** If there is more room available we start up the transmit
-      ** data process again. This can be direct I/O, if the cookmode
-      ** is set to COOK_RAW or COOK_MEDIUM, or will be a call to the
-      ** riotproc( T_OUTPUT ) if we are in COOK_WELL mode, to fetch
-      ** characters via the line discipline. We must always call
-      ** the line discipline,
-      ** so that user input characters can be echoed correctly.
-      **
-      ** ++++ Update +++++
-      ** With the advent of double buffering, we now see if
-      ** TxBufferOut-In is non-zero. If so, then we copy a packet
-      ** to the output place, and set it going. If this empties
-      ** the buffer, then we must issue a wakeup( ) on OUT.
-      ** If it frees space in the buffer then we must issue
-      ** a wakeup( ) on IN.
-      **
-      ** ++++ Extra! Extra! If PortP->WflushFlag is set, then we
-      ** have to send a WFLUSH command down the PHB, to mark the
-      ** end point of a WFLUSH. We also need to clear out any
-      ** data from the double buffer! ( note that WflushFlag is a
-      ** *count* of the number of WFLUSH commands outstanding! )
-      **
-      ** ++++ And there's more!
-      ** If an RTA is powered off, then on again, and rebooted,
-      ** whilst it has ports open, then we need to re-open the ports.
-      ** ( reasonable enough ). We can't do this when we spot the
-      ** re-boot, in interrupt time, because the queue is probably
-      ** full. So, when we come in here, we need to test if any
-      ** ports are in this condition, and re-open the port before
-      ** we try to send any more data to it. Now, the re-booted
-      ** RTA will be discarding packets from the PHB until it
-      ** receives this open packet, but don't worry tooo much
-      ** about that. The one thing that is interesting is the
-      ** combination of this effect and the WFLUSH effect!
-      */
-      /* For now don't handle RTA reboots. -- REW. 
-        Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */
-      if ( PortP->MagicFlags ) {
-#if 1
-       if ( PortP->MagicFlags & MAGIC_REBOOT ) {
-         /*
-         ** well, the RTA has been rebooted, and there is room
-         ** on its queue to add the open packet that is required.
-         **
-         ** The messy part of this line is trying to decide if
-         ** we need to call the Param function as a tty or as
-         ** a modem.
-         ** DONT USE CLOCAL AS A TEST FOR THIS!
-         **
-         ** If we can't param the port, then move on to the
-         ** next port.
-         */
-         PortP->InUse = NOT_INUSE;
-
-         rio_spin_unlock(&PortP->portSem);
-         if ( RIOParam(PortP, OPEN, ((PortP->Cor2Copy & 
-                                      (COR2_RTSFLOW|COR2_CTSFLOW ) )== 
-                                     (COR2_RTSFLOW|COR2_CTSFLOW ) ) ? 
-                       TRUE : FALSE, DONT_SLEEP ) == RIO_FAIL ) {
-           continue; /* with next port */
-         }
-         rio_spin_lock(&PortP->portSem);
-         PortP->MagicFlags &= ~MAGIC_REBOOT;
+                                ** MAGIC! ( Basically, handshake the RX buffer, so that
+                                ** the RTAs upstream can be re-enabled. )
+                                */
+                               rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n");
+                               WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
+                       }
+                       rio_spin_unlock(&PortP->portSem);
+               }
        }
+
+       if (RWORD(HostP->ParmMapP->tx_intr)) {
+               int port;
+
+               WWORD(HostP->ParmMapP->tx_intr, 0);
+
+               p->RIOTxCount++;
+               TxIntr++;
+               rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP - p->RIOHosts);
+
+               /*
+                ** Loop through every port.
+                ** If the port is mapped into the system ( i.e. has /dev/ttyXXXX
+                ** associated ) then it is worth checking.
+                */
+               for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
+                       struct Port *PortP = p->RIOPortp[port];
+                       struct tty_struct *ttyP;
+                       struct PKT *PacketP;
+
+                       /*
+                        ** not mapped in - most of the RIOPortp[] information
+                        ** has not been set up!
+                        */
+                       if (!PortP->Mapped) {
+                               port += 7;
+                               continue;       /* with the next port */
+                       }
+
+                       /*
+                        ** If the host board isn't running, then its data structures
+                        ** are no use to us - continue quietly.
+                        */
+                       if (PortP->HostP != HostP) {
+                               port += 7;
+                               continue;       /* with the next port */
+                       }
+
+                       /*
+                        ** Let us see - is the port open? If not, then don't service it.
+                        */
+                       if (!(PortP->PortState & PORT_ISOPEN)) {
+                               continue;
+                       }
+
+                       rio_dprintk(RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port);
+                       /*
+                        ** Lock the port before we begin working on it.
+                        */
+                       rio_spin_lock(&PortP->portSem);
+
+                       /*
+                        ** If we can't add anything to the transmit queue, then
+                        ** we need do none of this processing.
+                        */
+                       if (!can_add_transmit(&PacketP, PortP)) {
+                               rio_dprintk(RIO_DEBUG_INTR, "Can't add to port, so skipping.\n");
+                               rio_spin_unlock(&PortP->portSem);
+                               continue;
+                       }
+
+                       /*
+                        ** find corresponding tty structure. The process of mapping
+                        ** the ports puts these here.
+                        */
+                       ttyP = PortP->gs.tty;
+                       /* If ttyP is NULL, the port is getting closed. Forget about it. */
+                       if (!ttyP) {
+                               rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n");
+                               rio_spin_unlock(&PortP->portSem);
+                               continue;
+                       }
+                       /*
+                        ** If there is more room available we start up the transmit
+                        ** data process again. This can be direct I/O, if the cookmode
+                        ** is set to COOK_RAW or COOK_MEDIUM, or will be a call to the
+                        ** riotproc( T_OUTPUT ) if we are in COOK_WELL mode, to fetch
+                        ** characters via the line discipline. We must always call
+                        ** the line discipline,
+                        ** so that user input characters can be echoed correctly.
+                        **
+                        ** ++++ Update +++++
+                        ** With the advent of double buffering, we now see if
+                        ** TxBufferOut-In is non-zero. If so, then we copy a packet
+                        ** to the output place, and set it going. If this empties
+                        ** the buffer, then we must issue a wakeup( ) on OUT.
+                        ** If it frees space in the buffer then we must issue
+                        ** a wakeup( ) on IN.
+                        **
+                        ** ++++ Extra! Extra! If PortP->WflushFlag is set, then we
+                        ** have to send a WFLUSH command down the PHB, to mark the
+                        ** end point of a WFLUSH. We also need to clear out any
+                        ** data from the double buffer! ( note that WflushFlag is a
+                        ** *count* of the number of WFLUSH commands outstanding! )
+                        **
+                        ** ++++ And there's more!
+                        ** If an RTA is powered off, then on again, and rebooted,
+                        ** whilst it has ports open, then we need to re-open the ports.
+                        ** ( reasonable enough ). We can't do this when we spot the
+                        ** re-boot, in interrupt time, because the queue is probably
+                        ** full. So, when we come in here, we need to test if any
+                        ** ports are in this condition, and re-open the port before
+                        ** we try to send any more data to it. Now, the re-booted
+                        ** RTA will be discarding packets from the PHB until it
+                        ** receives this open packet, but don't worry tooo much
+                        ** about that. The one thing that is interesting is the
+                        ** combination of this effect and the WFLUSH effect!
+                        */
+                       /* For now don't handle RTA reboots. -- REW.
+                          Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */
+                       if (PortP->MagicFlags) {
+#if 1
+                               if (PortP->MagicFlags & MAGIC_REBOOT) {
+                                       /*
+                                        ** well, the RTA has been rebooted, and there is room
+                                        ** on its queue to add the open packet that is required.
+                                        **
+                                        ** The messy part of this line is trying to decide if
+                                        ** we need to call the Param function as a tty or as
+                                        ** a modem.
+                                        ** DONT USE CLOCAL AS A TEST FOR THIS!
+                                        **
+                                        ** If we can't param the port, then move on to the
+                                        ** next port.
+                                        */
+                                       PortP->InUse = NOT_INUSE;
+
+                                       rio_spin_unlock(&PortP->portSem);
+                                       if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? TRUE : FALSE, DONT_SLEEP) == RIO_FAIL) {
+                                               continue;       /* with next port */
+                                       }
+                                       rio_spin_lock(&PortP->portSem);
+                                       PortP->MagicFlags &= ~MAGIC_REBOOT;
+                               }
 #endif
 
-       /*
-       ** As mentioned above, this is a tacky hack to cope
-       ** with WFLUSH
-       */
-       if ( PortP->WflushFlag ) {
-         rio_dprintk (RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n");
-
-         if ( PortP->InUse )
-           rio_dprintk (RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n");
-       }
-                               
-       while ( PortP->WflushFlag &&
-               can_add_transmit( &PacketP, PortP ) && 
-               ( PortP->InUse == NOT_INUSE ) ) {
-         int p;
-         struct PktCmd *PktCmdP;
-
-         rio_dprintk (RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n");
-         /*
-         ** make it look just like a WFLUSH command
-         */
-         PktCmdP = ( struct PktCmd * )&PacketP->data[0];
-
-         WBYTE( PktCmdP->Command , WFLUSH );
-
-         p =  PortP->HostPort % ( ushort )PORTS_PER_RTA;
-
-         /*
-         ** If second block of ports for 16 port RTA, add 8
-         ** to index 8-15.
-         */
-         if ( PortP->SecondBlock )
-           p += PORTS_PER_RTA;
-
-         WBYTE( PktCmdP->PhbNum, p );
-
-         /*
-         ** to make debuggery easier
-         */
-         WBYTE( PacketP->data[ 2], 'W'  );
-         WBYTE( PacketP->data[ 3], 'F'  );
-         WBYTE( PacketP->data[ 4], 'L'  );
-         WBYTE( PacketP->data[ 5], 'U'  );
-         WBYTE( PacketP->data[ 6], 'S'  );
-         WBYTE( PacketP->data[ 7], 'H'  );
-         WBYTE( PacketP->data[ 8], ' '  );
-         WBYTE( PacketP->data[ 9], '0'+PortP->WflushFlag );
-         WBYTE( PacketP->data[10], ' '  );
-         WBYTE( PacketP->data[11], ' '  );
-         WBYTE( PacketP->data[12], '\0' );
-
-         /*
-         ** its two bytes long!
-         */
-         WBYTE( PacketP->len , PKT_CMD_BIT | 2 );
-
-         /*
-         ** queue it!
-         */
-         if ( !( PortP->State & RIO_DELETED ) ) {
-           add_transmit( PortP );
-           /*
-           ** Count chars tx'd for port statistics reporting
-           */
-           if ( PortP->statsGather )
-             PortP->txchars += 2;
-         }
-
-         if ( --( PortP->WflushFlag ) == 0 ) {
-           PortP->MagicFlags &= ~MAGIC_FLUSH;
-         }
-
-         rio_dprintk (RIO_DEBUG_INTR, "Wflush count now stands at %d\n", 
-                PortP->WflushFlag);
-       }
-       if ( PortP->MagicFlags & MORE_OUTPUT_EYGOR ) {
-         if ( PortP->MagicFlags & MAGIC_FLUSH ) {
-           PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
-         }
-         else {
-           if ( !can_add_transmit( &PacketP, PortP ) ) {
-             rio_spin_unlock(&PortP->portSem);
-             continue;
-           }
-           rio_spin_unlock(&PortP->portSem);
-           RIOTxEnable((char *)PortP);
-           rio_spin_lock(&PortP->portSem);
-           PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
-         }
+                               /*
+                                ** As mentioned above, this is a tacky hack to cope
+                                ** with WFLUSH
+                                */
+                               if (PortP->WflushFlag) {
+                                       rio_dprintk(RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n");
+
+                                       if (PortP->InUse)
+                                               rio_dprintk(RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n");
+                               }
+
+                               while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) {
+                                       int p;
+                                       struct PktCmd *PktCmdP;
+
+                                       rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n");
+                                       /*
+                                        ** make it look just like a WFLUSH command
+                                        */
+                                       PktCmdP = (struct PktCmd *) &PacketP->data[0];
+
+                                       WBYTE(PktCmdP->Command, WFLUSH);
+
+                                       p = PortP->HostPort % (ushort) PORTS_PER_RTA;
+
+                                       /*
+                                        ** If second block of ports for 16 port RTA, add 8
+                                        ** to index 8-15.
+                                        */
+                                       if (PortP->SecondBlock)
+                                               p += PORTS_PER_RTA;
+
+                                       WBYTE(PktCmdP->PhbNum, p);
+
+                                       /*
+                                        ** to make debuggery easier
+                                        */
+                                       WBYTE(PacketP->data[2], 'W');
+                                       WBYTE(PacketP->data[3], 'F');
+                                       WBYTE(PacketP->data[4], 'L');
+                                       WBYTE(PacketP->data[5], 'U');
+                                       WBYTE(PacketP->data[6], 'S');
+                                       WBYTE(PacketP->data[7], 'H');
+                                       WBYTE(PacketP->data[8], ' ');
+                                       WBYTE(PacketP->data[9], '0' + PortP->WflushFlag);
+                                       WBYTE(PacketP->data[10], ' ');
+                                       WBYTE(PacketP->data[11], ' ');
+                                       WBYTE(PacketP->data[12], '\0');
+
+                                       /*
+                                        ** its two bytes long!
+                                        */
+                                       WBYTE(PacketP->len, PKT_CMD_BIT | 2);
+
+                                       /*
+                                        ** queue it!
+                                        */
+                                       if (!(PortP->State & RIO_DELETED)) {
+                                               add_transmit(PortP);
+                                               /*
+                                                ** Count chars tx'd for port statistics reporting
+                                                */
+                                               if (PortP->statsGather)
+                                                       PortP->txchars += 2;
+                                       }
+
+                                       if (--(PortP->WflushFlag) == 0) {
+                                               PortP->MagicFlags &= ~MAGIC_FLUSH;
+                                       }
+
+                                       rio_dprintk(RIO_DEBUG_INTR, "Wflush count now stands at %d\n", PortP->WflushFlag);
+                               }
+                               if (PortP->MagicFlags & MORE_OUTPUT_EYGOR) {
+                                       if (PortP->MagicFlags & MAGIC_FLUSH) {
+                                               PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
+                                       } else {
+                                               if (!can_add_transmit(&PacketP, PortP)) {
+                                                       rio_spin_unlock(&PortP->portSem);
+                                                       continue;
+                                               }
+                                               rio_spin_unlock(&PortP->portSem);
+                                               RIOTxEnable((char *) PortP);
+                                               rio_spin_lock(&PortP->portSem);
+                                               PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
+                                       }
+                               }
+                       }
+
+
+                       /*
+                        ** If we can't add anything to the transmit queue, then
+                        ** we need do none of the remaining processing.
+                        */
+                       if (!can_add_transmit(&PacketP, PortP)) {
+                               rio_spin_unlock(&PortP->portSem);
+                               continue;
+                       }
+
+                       rio_spin_unlock(&PortP->portSem);
+                       RIOTxEnable((char *) PortP);
+               }
        }
-      }
-
-
-      /*
-      ** If we can't add anything to the transmit queue, then
-      ** we need do none of the remaining processing.
-      */
-      if (!can_add_transmit( &PacketP, PortP ) ) {
-       rio_spin_unlock(&PortP->portSem);
-       continue;
-      }
-
-      rio_spin_unlock(&PortP->portSem);
-      RIOTxEnable((char *)PortP);
-    }
-  }
 }
 
 /*
@@ -551,176 +533,162 @@ int From;
 ** NB: Called with the tty locked. The spl from the lockb( ) is passed.
 ** we return the ttySpl level that we re-locked at.
 */
-static void
-RIOReceive(p, PortP)
-struct rio_info *      p;
-struct Port *          PortP;
+static void RIOReceive(p, PortP)
+struct rio_info *p;
+struct Port *PortP;
 {
-  struct tty_struct *TtyP;
-  register ushort transCount;
-  struct PKT *PacketP;
-  register uint        DataCnt;
-  uchar *      ptr;
-  unsigned char *buf;
-  int copied =0;
-
-  static int intCount, RxIntCnt;
-
-  /*
-  ** The receive data process is to remove packets from the
-  ** PHB until there aren't any more or the current cblock
-  ** is full. When this occurs, there will be some left over
-  ** data in the packet, that we must do something with.
-  ** As we haven't unhooked the packet from the read list
-  ** yet, we can just leave the packet there, having first
-  ** made a note of how far we got. This means that we need
-  ** a pointer per port saying where we start taking the
-  ** data from - this will normally be zero, but when we
-  ** run out of space it will be set to the offset of the
-  ** next byte to copy from the packet data area. The packet
-  ** length field is decremented by the number of bytes that
-  ** we succesfully removed from the packet. When this reaches
-  ** zero, we reset the offset pointer to be zero, and free
-  ** the packet from the front of the queue.
-  */
-
-  intCount++;
-
-  TtyP = PortP->gs.tty;
-  if (!TtyP) {
-    rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
-    return;
-  }
-
-  if (PortP->State & RIO_THROTTLE_RX) {
-    rio_dprintk (RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n");
-    return;
-  }
-
-  if ( PortP->State & RIO_DELETED )
-    {
-      while ( can_remove_receive( &PacketP, PortP ) )
-       {
-         remove_receive( PortP );
-         put_free_end( PortP->HostP, PacketP );
+       struct tty_struct *TtyP;
+       register ushort transCount;
+       struct PKT *PacketP;
+       register uint DataCnt;
+       uchar *ptr;
+       unsigned char *buf;
+       int copied = 0;
+
+       static int intCount, RxIntCnt;
+
+       /*
+        ** The receive data process is to remove packets from the
+        ** PHB until there aren't any more or the current cblock
+        ** is full. When this occurs, there will be some left over
+        ** data in the packet, that we must do something with.
+        ** As we haven't unhooked the packet from the read list
+        ** yet, we can just leave the packet there, having first
+        ** made a note of how far we got. This means that we need
+        ** a pointer per port saying where we start taking the
+        ** data from - this will normally be zero, but when we
+        ** run out of space it will be set to the offset of the
+        ** next byte to copy from the packet data area. The packet
+        ** length field is decremented by the number of bytes that
+        ** we succesfully removed from the packet. When this reaches
+        ** zero, we reset the offset pointer to be zero, and free
+        ** the packet from the front of the queue.
+        */
+
+       intCount++;
+
+       TtyP = PortP->gs.tty;
+       if (!TtyP) {
+               rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
+               return;
        }
-    }
-  else
-    {
-      /*
-      ** loop, just so long as:
-      **   i ) there's some data ( i.e. can_remove_receive )
-      **  ii ) we haven't been blocked
-      ** iii ) there's somewhere to put the data
-      **  iv ) we haven't outstayed our welcome
-      */
-      transCount = 1;
-      while ( can_remove_receive(&PacketP, PortP)
-             && transCount)
-       {
+
+       if (PortP->State & RIO_THROTTLE_RX) {
+               rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n");
+               return;
+       }
+
+       if (PortP->State & RIO_DELETED) {
+               while (can_remove_receive(&PacketP, PortP)) {
+                       remove_receive(PortP);
+                       put_free_end(PortP->HostP, PacketP);
+               }
+       } else {
+               /*
+                ** loop, just so long as:
+                **   i ) there's some data ( i.e. can_remove_receive )
+                **  ii ) we haven't been blocked
+                ** iii ) there's somewhere to put the data
+                **  iv ) we haven't outstayed our welcome
+                */
+               transCount = 1;
+               while (can_remove_receive(&PacketP, PortP)
+                      && transCount) {
 #ifdef STATS
-         PortP->Stat.RxIntCnt++;
-#endif /* STATS */
-         RxIntCnt++;
-
-         /*
-         ** check that it is not a command!
-         */
-         if ( PacketP->len & PKT_CMD_BIT ) {
-           rio_dprintk (RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n");
-           /*      rio_dprint(RIO_DEBUG_INTR, (" sysport   = %d\n", p->RIOPortp->PortNum)); */
-           rio_dprintk (RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit);
-           rio_dprintk (RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port);
-           rio_dprintk (RIO_DEBUG_INTR, " src_unit  = %d\n", PacketP->src_unit);
-           rio_dprintk (RIO_DEBUG_INTR, " src_port  = %d\n", PacketP->src_port);
-           rio_dprintk (RIO_DEBUG_INTR, " len     = %d\n", PacketP->len);
-           rio_dprintk (RIO_DEBUG_INTR, " control   = %d\n", PacketP->control);
-           rio_dprintk (RIO_DEBUG_INTR, " csum    = %d\n", PacketP->csum);
-           rio_dprintk (RIO_DEBUG_INTR, "       data bytes: ");
-           for ( DataCnt=0; DataCnt<PKT_MAX_DATA_LEN; DataCnt++ )
-             rio_dprintk (RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]);
-           remove_receive( PortP );
-           put_free_end( PortP->HostP, PacketP );
-           continue; /* with next packet */
-         }
-
-         /*
-         ** How many characters can we move 'upstream' ?
-         **
-         ** Determine the minimum of the amount of data
-         ** available and the amount of space in which to
-         ** put it.
-         **
-         ** 1. Get the packet length by masking 'len'
-         **    for only the length bits.
-         ** 2. Available space is [buffer size] - [space used]
-         **
-         ** Transfer count is the minimum of packet length
-         ** and available space.
-         */
-                       
-         transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK);
-         rio_dprintk (RIO_DEBUG_REC,  "port %d: Copy %d bytes\n", 
-                                     PortP->PortNum, transCount);
-         /*
-         ** To use the following 'kkprintfs' for debugging - change the '#undef'
-         ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the
-         ** driver).
-         */
+                       PortP->Stat.RxIntCnt++;
+#endif                         /* STATS */
+                       RxIntCnt++;
+
+                       /*
+                        ** check that it is not a command!
+                        */
+                       if (PacketP->len & PKT_CMD_BIT) {
+                               rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n");
+                               /*      rio_dprint(RIO_DEBUG_INTR, (" sysport   = %d\n", p->RIOPortp->PortNum)); */
+                               rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit);
+                               rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port);
+                               rio_dprintk(RIO_DEBUG_INTR, " src_unit  = %d\n", PacketP->src_unit);
+                               rio_dprintk(RIO_DEBUG_INTR, " src_port  = %d\n", PacketP->src_port);
+                               rio_dprintk(RIO_DEBUG_INTR, " len          = %d\n", PacketP->len);
+                               rio_dprintk(RIO_DEBUG_INTR, " control   = %d\n", PacketP->control);
+                               rio_dprintk(RIO_DEBUG_INTR, " csum         = %d\n", PacketP->csum);
+                               rio_dprintk(RIO_DEBUG_INTR, "    data bytes: ");
+                               for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++)
+                                       rio_dprintk(RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]);
+                               remove_receive(PortP);
+                               put_free_end(PortP->HostP, PacketP);
+                               continue;       /* with next packet */
+                       }
+
+                       /*
+                        ** How many characters can we move 'upstream' ?
+                        **
+                        ** Determine the minimum of the amount of data
+                        ** available and the amount of space in which to
+                        ** put it.
+                        **
+                        ** 1.        Get the packet length by masking 'len'
+                        **   for only the length bits.
+                        ** 2.        Available space is [buffer size] - [space used]
+                        **
+                        ** Transfer count is the minimum of packet length
+                        ** and available space.
+                        */
+
+                       transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK);
+                       rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount);
+                       /*
+                        ** To use the following 'kkprintfs' for debugging - change the '#undef'
+                        ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the
+                        ** driver).
+                        */
 #undef ___DEBUG_IT___
 #ifdef ___DEBUG_IT___
-         kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ",
-                  intCount,
-                  RxIntCnt,
-                  PortP->PortNum,
-                  TtyP->rxqueue.count,
-                  transCount,
-                  TtyP->flags );
+                       kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", intCount, RxIntCnt, PortP->PortNum, TtyP->rxqueue.count, transCount, TtyP->flags);
 #endif
-         ptr = (uchar *) PacketP->data + PortP->RxDataStart;
+                       ptr = (uchar *) PacketP->data + PortP->RxDataStart;
 
-         tty_prepare_flip_string(TtyP, &buf, transCount);
-         rio_memcpy_fromio (buf, ptr, transCount);
+                       tty_prepare_flip_string(TtyP, &buf, transCount);
+                       rio_memcpy_fromio(buf, ptr, transCount);
 #ifdef STATS
-         /*
-         ** keep a count for statistical purposes
-         */
-         PortP->Stat.RxCharCnt += transCount;
+                       /*
+                        ** keep a count for statistical purposes
+                        */
+                       PortP->Stat.RxCharCnt += transCount;
 #endif
-         PortP->RxDataStart    += transCount;
-         PacketP->len          -= transCount;
-         copied += transCount;
+                       PortP->RxDataStart += transCount;
+                       PacketP->len -= transCount;
+                       copied += transCount;
 
 
 #ifdef ___DEBUG_IT___
-         kkprintf("T:%d L:%d\n", DataCnt, PacketP->len );
+                       kkprintf("T:%d L:%d\n", DataCnt, PacketP->len);
 #endif
 
-         if ( PacketP->len == 0 )
-           {
+                       if (PacketP->len == 0) {
                                /*
-                               ** If we have emptied the packet, then we can
-                               ** free it, and reset the start pointer for
-                               ** the next packet.
-                               */
-             remove_receive( PortP );
-             put_free_end( PortP->HostP, PacketP );
-             PortP->RxDataStart = 0;
+                                ** If we have emptied the packet, then we can
+                                ** free it, and reset the start pointer for
+                                ** the next packet.
+                                */
+                               remove_receive(PortP);
+                               put_free_end(PortP->HostP, PacketP);
+                               PortP->RxDataStart = 0;
 #ifdef STATS
                                /*
-                               ** more lies ( oops, I mean statistics )
-                               */
-             PortP->Stat.RxPktCnt++;
-#endif /* STATS */
-           }
+                                ** more lies ( oops, I mean statistics )
+                                */
+                               PortP->Stat.RxPktCnt++;
+#endif                         /* STATS */
+                       }
+               }
+       }
+       if (copied) {
+               rio_dprintk(RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied);
+               tty_flip_buffer_push(TtyP);
        }
-    }
-  if (copied) {
-    rio_dprintk (RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied);
-    tty_flip_buffer_push (TtyP);
-  }
 
-  return;
+       return;
 }
 
 #ifdef FUTURE_RELEASE
@@ -728,221 +696,210 @@ struct Port *           PortP;
 ** The proc routine called by the line discipline to do the work for it.
 ** The proc routine works hand in hand with the interrupt routine.
 */
-int
-riotproc(p, tp, cmd, port)
-struct rio_info *      p;
+int riotproc(p, tp, cmd, port)
+struct rio_info *p;
 register struct ttystatics *tp;
 int cmd;
-int    port;
+int port;
 {
        register struct Port *PortP;
        int SysPort;
        struct PKT *PacketP;
 
-       SysPort = port; /* Believe me, it works. */
+       SysPort = port;         /* Believe me, it works. */
 
-       if ( SysPort < 0 || SysPort >= RIO_PORTS ) {
-               rio_dprintk (RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n",SysPort);
+       if (SysPort < 0 || SysPort >= RIO_PORTS) {
+               rio_dprintk(RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n", SysPort);
                return 0;
        }
        PortP = p->RIOPortp[SysPort];
 
-       if ((uint)PortP->PhbP < (uint)PortP->Caddr || 
-                       (uint)PortP->PhbP >= (uint)PortP->Caddr+SIXTY_FOUR_K ) {
-               rio_dprintk (RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n",
-                                                       SysPort);
-               rio_dprintk (RIO_DEBUG_INTR, "   PortP = 0x%x\n",PortP);
-               rio_dprintk (RIO_DEBUG_INTR, "   PortP->PhbP = 0x%x\n",PortP->PhbP);
-               rio_dprintk (RIO_DEBUG_INTR, "   PortP->Caddr = 0x%x\n",PortP->PhbP);
-               rio_dprintk (RIO_DEBUG_INTR, "   PortP->HostPort = 0x%x\n",PortP->HostPort);
+       if ((uint) PortP->PhbP < (uint) PortP->Caddr || (uint) PortP->PhbP >= (uint) PortP->Caddr + SIXTY_FOUR_K) {
+               rio_dprintk(RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", SysPort);
+               rio_dprintk(RIO_DEBUG_INTR, "    PortP = 0x%x\n", PortP);
+               rio_dprintk(RIO_DEBUG_INTR, "    PortP->PhbP = 0x%x\n", PortP->PhbP);
+               rio_dprintk(RIO_DEBUG_INTR, "    PortP->Caddr = 0x%x\n", PortP->PhbP);
+               rio_dprintk(RIO_DEBUG_INTR, "    PortP->HostPort = 0x%x\n", PortP->HostPort);
                return 0;
        }
 
-       switch(cmd) {
-               case T_WFLUSH:
-                       rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH\n");
+       switch (cmd) {
+       case T_WFLUSH:
+               rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH\n");
+               /*
+                ** Because of the spooky way the RIO works, we don't need
+                ** to issue a flush command on any of the SET*F commands,
+                ** as that causes trouble with getty and login, which issue
+                ** these commands to incur a READ flush, and rely on the fact
+                ** that the line discipline does a wait for drain for them.
+                ** As the rio doesn't wait for drain, the write flush would
+                ** destroy the Password: prompt. This isn't very friendly, so
+                ** here we only issue a WFLUSH command if we are in the interrupt
+                ** routine, or we aren't executing a SET*F command.
+                */
+               if (PortP->HostP->InIntr || !PortP->FlushCmdBodge) {
                        /*
-                       ** Because of the spooky way the RIO works, we don't need
-                       ** to issue a flush command on any of the SET*F commands,
-                       ** as that causes trouble with getty and login, which issue
-                       ** these commands to incur a READ flush, and rely on the fact
-                       ** that the line discipline does a wait for drain for them.
-                       ** As the rio doesn't wait for drain, the write flush would
-                       ** destroy the Password: prompt. This isn't very friendly, so
-                       ** here we only issue a WFLUSH command if we are in the interrupt
-                       ** routine, or we aren't executing a SET*F command.
-                       */
-                       if ( PortP->HostP->InIntr || !PortP->FlushCmdBodge ) {
-                               /*
-                               ** form a wflush packet - 1 byte long, no data
-                               */
-                               if ( PortP->State & RIO_DELETED ) {
-                                       rio_dprintk (RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n");
-                               }
-                               else {
-                                       if ( RIOPreemptiveCmd(p, PortP, WFLUSH ) == RIO_FAIL ) {
-                                               rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command failed\n");
-                                       }
-                                       else
-                                               rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command\n");
-                               }
-                               /*
-                               ** WFLUSH operation - flush the data!
-                               */
-                               PortP->TxBufferIn = PortP->TxBufferOut = 0;
-                       }
-                       else {
-                               rio_dprintk (RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n");
+                        ** form a wflush packet - 1 byte long, no data
+                        */
+                       if (PortP->State & RIO_DELETED) {
+                               rio_dprintk(RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n");
+                       } else {
+                               if (RIOPreemptiveCmd(p, PortP, WFLUSH) == RIO_FAIL) {
+                                       rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command failed\n");
+                               } else
+                                       rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command\n");
                        }
                        /*
-                       ** sort out the line discipline
-                       */
-                       if (PortP->CookMode == COOK_WELL)
-                               goto start;
-                       break;
-       
-               case T_RESUME:
-                       rio_dprintk (RIO_DEBUG_INTR, "T_RESUME\n");
-                       /*
-                       ** send pre-emptive resume packet
-                       */
-                       if ( PortP->State & RIO_DELETED ) {
-                               rio_dprintk (RIO_DEBUG_INTR, "RESUME on deleted RTA\n");
+                        ** WFLUSH operation - flush the data!
+                        */
+                       PortP->TxBufferIn = PortP->TxBufferOut = 0;
+               } else {
+                       rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n");
+               }
+               /*
+                ** sort out the line discipline
+                */
+               if (PortP->CookMode == COOK_WELL)
+                       goto start;
+               break;
+
+       case T_RESUME:
+               rio_dprintk(RIO_DEBUG_INTR, "T_RESUME\n");
+               /*
+                ** send pre-emptive resume packet
+                */
+               if (PortP->State & RIO_DELETED) {
+                       rio_dprintk(RIO_DEBUG_INTR, "RESUME on deleted RTA\n");
+               } else {
+                       if (RIOPreemptiveCmd(p, PortP, RESUME) == RIO_FAIL) {
+                               rio_dprintk(RIO_DEBUG_INTR, "T_RESUME Command failed\n");
                        }
-                       else {
-                               if ( RIOPreemptiveCmd(p, PortP, RESUME ) == RIO_FAIL ) {
-                                       rio_dprintk (RIO_DEBUG_INTR, "T_RESUME Command failed\n");
-                               }
+               }
+               /*
+                ** and re-start the sender software!
+                */
+               if (PortP->CookMode == COOK_WELL)
+                       goto start;
+               break;
+
+       case T_TIME:
+               rio_dprintk(RIO_DEBUG_INTR, "T_TIME\n");
+               /*
+                ** T_TIME is called when xDLY is set in oflags and
+                ** the line discipline timeout has expired. It's
+                ** function in life is to clear the TIMEOUT flag
+                ** and to re-start output to the port.
+                */
+               /*
+                ** Fall through and re-start output
+                */
+       case T_OUTPUT:
+             start:
+               if (PortP->MagicFlags & MAGIC_FLUSH) {
+                       PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
+                       return 0;
+               }
+               RIOTxEnable((char *) PortP);
+               PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
+               /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n"); */
+               break;
+
+       case T_SUSPEND:
+               rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND\n");
+               /*
+                ** send a suspend pre-emptive packet.
+                */
+               if (PortP->State & RIO_DELETED) {
+                       rio_dprintk(RIO_DEBUG_INTR, "SUSPEND deleted RTA\n");
+               } else {
+                       if (RIOPreemptiveCmd(p, PortP, SUSPEND) == RIO_FAIL) {
+                               rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND Command failed\n");
                        }
-                       /*
-                       ** and re-start the sender software!
-                       */
-                       if (PortP->CookMode == COOK_WELL)
-                               goto start;
-                       break;
-       
-               case T_TIME:
-                       rio_dprintk (RIO_DEBUG_INTR, "T_TIME\n");
-                       /*
-                       ** T_TIME is called when xDLY is set in oflags and
-                       ** the line discipline timeout has expired. It's
-                       ** function in life is to clear the TIMEOUT flag
-                       ** and to re-start output to the port.
-                       */
-                       /*
-                       ** Fall through and re-start output
-                       */
-               case T_OUTPUT:
-start:
-                       if ( PortP->MagicFlags & MAGIC_FLUSH ) {
-                               PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
+               }
+               /*
+                ** done!
+                */
+               break;
+
+       case T_BLOCK:
+               rio_dprintk(RIO_DEBUG_INTR, "T_BLOCK\n");
+               break;
+
+       case T_RFLUSH:
+               rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH\n");
+               if (PortP->State & RIO_DELETED) {
+                       rio_dprintk(RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n");
+                       PortP->RxDataStart = 0;
+               } else {
+                       if (RIOPreemptiveCmd(p, PortP, RFLUSH) == RIO_FAIL) {
+                               rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH Command failed\n");
                                return 0;
                        }
-                       RIOTxEnable((char *)PortP);
-                       PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
-                       /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n");*/
-                       break;
-       
-               case T_SUSPEND:
-                       rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND\n");
-                       /*
-                       ** send a suspend pre-emptive packet.
-                       */
-                       if ( PortP->State & RIO_DELETED ) {
-                               rio_dprintk (RIO_DEBUG_INTR, "SUSPEND deleted RTA\n");
-                       }
-                       else {
-                               if ( RIOPreemptiveCmd(p, PortP, SUSPEND ) == RIO_FAIL ) {
-                                       rio_dprintk (RIO_DEBUG_INTR, "T_SUSPEND Command failed\n");
-                               }
+                       PortP->RxDataStart = 0;
+                       while (can_remove_receive(&PacketP, PortP)) {
+                               remove_receive(PortP);
+                               ShowPacket(DBG_PROC, PacketP);
+                               put_free_end(PortP->HostP, PacketP);
                        }
-                       /*
-                       ** done!
-                       */
-                       break;
-       
-               case T_BLOCK:
-                       rio_dprintk (RIO_DEBUG_INTR, "T_BLOCK\n");
-                       break;
-       
-               case T_RFLUSH:
-                       rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH\n");
-                       if ( PortP->State & RIO_DELETED ) {
-                               rio_dprintk (RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n");
-                               PortP->RxDataStart = 0;
-                       }
-                       else {
-                               if ( RIOPreemptiveCmd( p, PortP, RFLUSH ) == RIO_FAIL ) {
-                                       rio_dprintk (RIO_DEBUG_INTR, "T_RFLUSH Command failed\n");
-                                       return 0;
-                               }
-                               PortP->RxDataStart = 0;
-                               while ( can_remove_receive(&PacketP, PortP) ) {
-                                       remove_receive(PortP);
-                                       ShowPacket(DBG_PROC, PacketP );
-                                       put_free_end(PortP->HostP, PacketP );
-                               }
-                               if ( PortP->PhbP->handshake == PHB_HANDSHAKE_SET ) {
-                                       /*
-                                       ** MAGIC!
-                                       */
-                                       rio_dprintk (RIO_DEBUG_INTR, "Set receive handshake bit\n");
-                                       PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET;
-                               }
-                       }
-                       break;
-                       /* FALLTHROUGH */
-               case T_UNBLOCK:
-                       rio_dprintk (RIO_DEBUG_INTR, "T_UNBLOCK\n");
-                       /*
-                       ** If there is any data to receive set a timeout to service it.
-                       */
-                       RIOReceive(p, PortP);
-                       break;
-       
-               case T_BREAK:
-                       rio_dprintk (RIO_DEBUG_INTR, "T_BREAK\n");
-                       /*
-                       ** Send a break command. For Sys V
-                       ** this is a timed break, so we
-                       ** send a SBREAK[time] packet
-                       */
-                       /*
-                       ** Build a BREAK command
-                       */
-                       if ( PortP->State & RIO_DELETED ) {
-                               rio_dprintk (RIO_DEBUG_INTR, "BREAK on deleted RTA\n");
+                       if (PortP->PhbP->handshake == PHB_HANDSHAKE_SET) {
+                               /*
+                                ** MAGIC!
+                                */
+                               rio_dprintk(RIO_DEBUG_INTR, "Set receive handshake bit\n");
+                               PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET;
                        }
-                       else {
-                               if (RIOShortCommand(PortP,SBREAK,2,
-                                                               p->RIOConf.BreakInterval)==RIO_FAIL) {
-                                       rio_dprintk (RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
-                               }
+               }
+               break;
+               /* FALLTHROUGH */
+       case T_UNBLOCK:
+               rio_dprintk(RIO_DEBUG_INTR, "T_UNBLOCK\n");
+               /*
+                ** If there is any data to receive set a timeout to service it.
+                */
+               RIOReceive(p, PortP);
+               break;
+
+       case T_BREAK:
+               rio_dprintk(RIO_DEBUG_INTR, "T_BREAK\n");
+               /*
+                ** Send a break command. For Sys V
+                ** this is a timed break, so we
+                ** send a SBREAK[time] packet
+                */
+               /*
+                ** Build a BREAK command
+                */
+               if (PortP->State & RIO_DELETED) {
+                       rio_dprintk(RIO_DEBUG_INTR, "BREAK on deleted RTA\n");
+               } else {
+                       if (RIOShortCommand(PortP, SBREAK, 2, p->RIOConf.BreakInterval) == RIO_FAIL) {
+                               rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
                        }
-       
-                       /*
-                       ** done!
-                       */
-                       break;
-       
-               case T_INPUT:
-                       rio_dprintk (RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n");
-                       break;
-               case T_PARM:
-                       rio_dprintk (RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n");
-                       break;
-       
-               case T_SWTCH:
-                       rio_dprintk (RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n");
-                       break;
-       
-               default:
-                       rio_dprintk (RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n",cmd);
+               }
+
+               /*
+                ** done!
+                */
+               break;
+
+       case T_INPUT:
+               rio_dprintk(RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n");
+               break;
+       case T_PARM:
+               rio_dprintk(RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n");
+               break;
+
+       case T_SWTCH:
+               rio_dprintk(RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n");
+               break;
+
+       default:
+               rio_dprintk(RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n", cmd);
        }
        /*
-       ** T_OUTPUT returns without passing through this point!
-       */
-       /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n");*/
-       return(0);
+        ** T_OUTPUT returns without passing through this point!
+        */
+       /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n"); */
+       return (0);
 }
 #endif
index c3d679733c9a6dd50a48235e08341362db3df4aa..14b83fae75c8ed1abc890615337e546decfa7850 100644 (file)
@@ -42,14 +42,14 @@ static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h    1.2";
 */
 
 struct portStats {
-       int     port;
-       int     gather;
-       ulong   txchars;
-       ulong   rxchars;
-       ulong   opens;
-       ulong   closes;
-       ulong   ioctls;
-}; 
+       int port;
+       int gather;
+       ulong txchars;
+       ulong rxchars;
+       ulong opens;
+       ulong closes;
+       ulong ioctls;
+};
 
 
 #define rIOC   ('r'<<8)
@@ -100,4 +100,4 @@ struct portStats {
 #define RIO_RESET_PORT_STATS   (RIOC | 194)
 #define RIO_GET_PORT_STATS     (RIOC | 195)
 
-#endif /* __rioioctl_h__ */
+#endif                         /* __rioioctl_h__ */
index f10916326ecc45510c8ba23179fa197b7e98ab54..4cc7f4942bfc969e2c4031fc7526fac365c08c55 100644 (file)
@@ -157,46 +157,44 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c  1.3";
 ** NB. for MPX
 **     tty lock must NOT have been previously acquired.
 */
-int
-RIOParam(PortP, cmd, Modem, SleepFlag)
+int RIOParam(PortP, cmd, Modem, SleepFlag)
 struct Port *PortP;
 int cmd;
 int Modem;
-int SleepFlag; 
+int SleepFlag;
 {
        register struct tty_struct *TtyP;
-       int     retval;
+       int retval;
        register struct phb_param *phb_param_ptr;
        PKT *PacketP;
        int res;
-       uchar Cor1=0, Cor2=0, Cor4=0, Cor5=0;
-       uchar TxXon=0, TxXoff=0, RxXon=0, RxXoff=0;
-       uchar LNext=0, TxBaud=0, RxBaud=0;
-       int             retries = 0xff;
+       uchar Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0;
+       uchar TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0;
+       uchar LNext = 0, TxBaud = 0, RxBaud = 0;
+       int retries = 0xff;
        unsigned long flags;
 
-       func_enter ();
+       func_enter();
 
        TtyP = PortP->gs.tty;
 
-       rio_dprintk (RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n",
-           PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP);
+       rio_dprintk(RIO_DEBUG_PARAM, "RIOParam: Port:%d cmd:%d Modem:%d SleepFlag:%d Mapped: %d, tty=%p\n", PortP->PortNum, cmd, Modem, SleepFlag, PortP->Mapped, TtyP);
 
        if (!TtyP) {
-         rio_dprintk (RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n");
+               rio_dprintk(RIO_DEBUG_PARAM, "Can't call rioparam with null tty.\n");
 
-         func_exit ();
+               func_exit();
 
-         return RIO_FAIL;
+               return RIO_FAIL;
        }
-       rio_spin_lock_irqsave(&PortP->portSem, flags );
+       rio_spin_lock_irqsave(&PortP->portSem, flags);
 
        if (cmd == OPEN) {
                /*
-               ** If the port is set to store or lock the parameters, and it is
-               ** paramed with OPEN, we want to restore the saved port termio, but
-               ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot.
-               */
+                ** If the port is set to store or lock the parameters, and it is
+                ** paramed with OPEN, we want to restore the saved port termio, but
+                ** only if StoredTermio has been saved, i.e. NOT 1st open after reboot.
+                */
 #if 0
                if (PortP->FirstOpen) {
                        PortP->StoredTty.iflag = TtyP->tm.c_iflag;
@@ -207,9 +205,8 @@ int SleepFlag;
                        for (i = 0; i < NCC + 5; i++)
                                PortP->StoredTty.cc[i] = TtyP->tm.c_cc[i];
                        PortP->FirstOpen = 0;
-               }
-               else if (PortP->Store || PortP->Lock) {
-                       rio_dprintk (RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n");
+               } else if (PortP->Store || PortP->Lock) {
+                       rio_dprintk(RIO_DEBUG_PARAM, "OPEN: Restoring stored/locked params\n");
                        TtyP->tm.c_iflag = PortP->StoredTty.iflag;
                        TtyP->tm.c_oflag = PortP->StoredTty.oflag;
                        TtyP->tm.c_cflag = PortP->StoredTty.cflag;
@@ -222,230 +219,222 @@ int SleepFlag;
        }
 
        /*
-       ** wait for space
-       */
-       while ( !(res=can_add_transmit(&PacketP,PortP)) || 
-                       (PortP->InUse != NOT_INUSE) ) {
-               if (retries -- <= 0) {
+        ** wait for space
+        */
+       while (!(res = can_add_transmit(&PacketP, PortP)) || (PortP->InUse != NOT_INUSE)) {
+               if (retries-- <= 0) {
                        break;
                }
-               if ( PortP->InUse != NOT_INUSE ) {
-                       rio_dprintk (RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n");
+               if (PortP->InUse != NOT_INUSE) {
+                       rio_dprintk(RIO_DEBUG_PARAM, "Port IN_USE for pre-emptive command\n");
                }
 
-               if ( !res ) {
-                       rio_dprintk (RIO_DEBUG_PARAM, "Port has no space on transmit queue\n");
+               if (!res) {
+                       rio_dprintk(RIO_DEBUG_PARAM, "Port has no space on transmit queue\n");
                }
 
-               if ( SleepFlag != OK_TO_SLEEP ) {
-                       rio_spin_unlock_irqrestore( &PortP->portSem, flags);
+               if (SleepFlag != OK_TO_SLEEP) {
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                        func_exit();
-                       
+
                        return RIO_FAIL;
                }
 
-               rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit\n");
-               rio_spin_unlock_irqrestore( &PortP->portSem, flags);
+               rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit\n");
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                retval = RIODelay(PortP, HUNDRED_MS);
-               rio_spin_lock_irqsave( &PortP->portSem, flags);
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
                if (retval == RIO_FAIL) {
-                       rio_dprintk (RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n");
-                       rio_spin_unlock_irqrestore( &PortP->portSem, flags);
+                       rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n");
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                        pseterr(EINTR);
                        func_exit();
 
                        return RIO_FAIL;
                }
-               if ( PortP->State & RIO_DELETED ) {
-                       rio_spin_unlock_irqrestore( &PortP->portSem, flags);
-                       func_exit ();
+               if (PortP->State & RIO_DELETED) {
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                       func_exit();
 
                        return RIO_SUCCESS;
                }
        }
 
        if (!res) {
-               rio_spin_unlock_irqrestore( &PortP->portSem, flags);
-               func_exit ();
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               func_exit();
 
                return RIO_FAIL;
        }
 
-       rio_dprintk (RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n",res);
-       rio_dprintk (RIO_DEBUG_PARAM, "Packet is 0x%x\n",(int) PacketP);
+       rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res);
+       rio_dprintk(RIO_DEBUG_PARAM, "Packet is 0x%x\n", (int) PacketP);
 
-       phb_param_ptr = (struct phb_param *)PacketP->data;
+       phb_param_ptr = (struct phb_param *) PacketP->data;
 
 
 #if 0
        /*
-       ** COR 1
-       */
-       if ( TtyP->tm.c_iflag & INPCK ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Parity checking on input enabled\n");
+        ** COR 1
+        */
+       if (TtyP->tm.c_iflag & INPCK) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Parity checking on input enabled\n");
                Cor1 |= COR1_INPCK;
        }
 #endif
 
-       switch ( TtyP->termios->c_cflag & CSIZE ) {
-               case CS5:
+       switch (TtyP->termios->c_cflag & CSIZE) {
+       case CS5:
                {
-                       rio_dprintk (RIO_DEBUG_PARAM, "5 bit data\n");
+                       rio_dprintk(RIO_DEBUG_PARAM, "5 bit data\n");
                        Cor1 |= COR1_5BITS;
                        break;
                }
-               case CS6:
+       case CS6:
                {
-                       rio_dprintk (RIO_DEBUG_PARAM, "6 bit data\n");
+                       rio_dprintk(RIO_DEBUG_PARAM, "6 bit data\n");
                        Cor1 |= COR1_6BITS;
                        break;
                }
-               case CS7:
+       case CS7:
                {
-                       rio_dprintk (RIO_DEBUG_PARAM, "7 bit data\n");
+                       rio_dprintk(RIO_DEBUG_PARAM, "7 bit data\n");
                        Cor1 |= COR1_7BITS;
                        break;
                }
-               case CS8:
+       case CS8:
                {
-                       rio_dprintk (RIO_DEBUG_PARAM, "8 bit data\n");
+                       rio_dprintk(RIO_DEBUG_PARAM, "8 bit data\n");
                        Cor1 |= COR1_8BITS;
                        break;
                }
        }
 
-       if ( TtyP->termios->c_cflag & CSTOPB ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "2 stop bits\n");
+       if (TtyP->termios->c_cflag & CSTOPB) {
+               rio_dprintk(RIO_DEBUG_PARAM, "2 stop bits\n");
                Cor1 |= COR1_2STOP;
-       }
-       else {
-               rio_dprintk (RIO_DEBUG_PARAM, "1 stop bit\n");
+       } else {
+               rio_dprintk(RIO_DEBUG_PARAM, "1 stop bit\n");
                Cor1 |= COR1_1STOP;
        }
 
-       if ( TtyP->termios->c_cflag & PARENB ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Enable parity\n");
+       if (TtyP->termios->c_cflag & PARENB) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Enable parity\n");
                Cor1 |= COR1_NORMAL;
-       }
-       else {
-               rio_dprintk (RIO_DEBUG_PARAM, "Disable parity\n");
+       } else {
+               rio_dprintk(RIO_DEBUG_PARAM, "Disable parity\n");
                Cor1 |= COR1_NOP;
        }
-       if ( TtyP->termios->c_cflag & PARODD ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Odd parity\n");
+       if (TtyP->termios->c_cflag & PARODD) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Odd parity\n");
                Cor1 |= COR1_ODD;
-       }
-       else {
-               rio_dprintk (RIO_DEBUG_PARAM, "Even parity\n");
-               Cor1 |= COR1_EVEN; 
+       } else {
+               rio_dprintk(RIO_DEBUG_PARAM, "Even parity\n");
+               Cor1 |= COR1_EVEN;
        }
 
        /*
-       ** COR 2
-       */
-       if ( TtyP->termios->c_iflag & IXON ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop output control\n");
+        ** COR 2
+        */
+       if (TtyP->termios->c_iflag & IXON) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop output control\n");
                Cor2 |= COR2_IXON;
-       }
-       else {
-               if ( PortP->Config & RIO_IXON ) {
-                       rio_dprintk (RIO_DEBUG_PARAM, "Force enable start/stop output control\n");
+       } else {
+               if (PortP->Config & RIO_IXON) {
+                       rio_dprintk(RIO_DEBUG_PARAM, "Force enable start/stop output control\n");
                        Cor2 |= COR2_IXON;
-               }
-               else
-                       rio_dprintk (RIO_DEBUG_PARAM, "IXON has been disabled.\n");
+               } else
+                       rio_dprintk(RIO_DEBUG_PARAM, "IXON has been disabled.\n");
        }
 
        if (TtyP->termios->c_iflag & IXANY) {
-               if ( PortP->Config & RIO_IXANY ) {
-                       rio_dprintk (RIO_DEBUG_PARAM, "Enable any key to restart output\n");
+               if (PortP->Config & RIO_IXANY) {
+                       rio_dprintk(RIO_DEBUG_PARAM, "Enable any key to restart output\n");
                        Cor2 |= COR2_IXANY;
-               }
-               else
-                       rio_dprintk (RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n");
+               } else
+                       rio_dprintk(RIO_DEBUG_PARAM, "IXANY has been disabled due to sanity reasons.\n");
        }
 
-       if ( TtyP->termios->c_iflag & IXOFF ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Enable start/stop input control 2\n");
+       if (TtyP->termios->c_iflag & IXOFF) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Enable start/stop input control 2\n");
                Cor2 |= COR2_IXOFF;
        }
 
-       if ( TtyP->termios->c_cflag & HUPCL ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Hangup on last close\n");
+       if (TtyP->termios->c_cflag & HUPCL) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Hangup on last close\n");
                Cor2 |= COR2_HUPCL;
        }
 
-       if ( C_CRTSCTS (TtyP)) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n");
+       if (C_CRTSCTS(TtyP)) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control enabled\n");
                Cor2 |= COR2_CTSFLOW;
                Cor2 |= COR2_RTSFLOW;
        } else {
-               rio_dprintk (RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n");
+               rio_dprintk(RIO_DEBUG_PARAM, "Rx hardware flow control disabled\n");
                Cor2 &= ~COR2_CTSFLOW;
                Cor2 &= ~COR2_RTSFLOW;
        }
 
 
-       if ( TtyP->termios->c_cflag & CLOCAL ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Local line\n");
-       }
-       else {
-               rio_dprintk (RIO_DEBUG_PARAM, "Possible Modem line\n");
+       if (TtyP->termios->c_cflag & CLOCAL) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Local line\n");
+       } else {
+               rio_dprintk(RIO_DEBUG_PARAM, "Possible Modem line\n");
        }
 
        /*
-       ** COR 4 (there is no COR 3)
-       */
-       if ( TtyP->termios->c_iflag & IGNBRK ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Ignore break condition\n");
+        ** COR 4 (there is no COR 3)
+        */
+       if (TtyP->termios->c_iflag & IGNBRK) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Ignore break condition\n");
                Cor4 |= COR4_IGNBRK;
        }
-       if ( !(TtyP->termios->c_iflag & BRKINT) ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Break generates NULL condition\n");
+       if (!(TtyP->termios->c_iflag & BRKINT)) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Break generates NULL condition\n");
                Cor4 |= COR4_NBRKINT;
        } else {
-               rio_dprintk (RIO_DEBUG_PARAM, "Interrupt on     break condition\n");
+               rio_dprintk(RIO_DEBUG_PARAM, "Interrupt on      break condition\n");
        }
 
-       if ( TtyP->termios->c_iflag & INLCR ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage return on input\n");
+       if (TtyP->termios->c_iflag & INLCR) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage return on input\n");
                Cor4 |= COR4_INLCR;
        }
 
-       if ( TtyP->termios->c_iflag & IGNCR ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Ignore carriage return on input\n");
+       if (TtyP->termios->c_iflag & IGNCR) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Ignore carriage return on input\n");
                Cor4 |= COR4_IGNCR;
        }
 
-       if ( TtyP->termios->c_iflag & ICRNL ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on input\n");
+       if (TtyP->termios->c_iflag & ICRNL) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on input\n");
                Cor4 |= COR4_ICRNL;
        }
-       if ( TtyP->termios->c_iflag & IGNPAR ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Ignore characters with parity errors\n");
+       if (TtyP->termios->c_iflag & IGNPAR) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Ignore characters with parity errors\n");
                Cor4 |= COR4_IGNPAR;
        }
-       if ( TtyP->termios->c_iflag & PARMRK ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Mark parity errors\n");
+       if (TtyP->termios->c_iflag & PARMRK) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Mark parity errors\n");
                Cor4 |= COR4_PARMRK;
        }
 
        /*
-       ** Set the RAISEMOD flag to ensure that the modem lines are raised
-       ** on reception of a config packet.
-       ** The download code handles the zero baud condition.
-       */
+        ** Set the RAISEMOD flag to ensure that the modem lines are raised
+        ** on reception of a config packet.
+        ** The download code handles the zero baud condition.
+        */
        Cor4 |= COR4_RAISEMOD;
 
        /*
-       ** COR 5
-       */
+        ** COR 5
+        */
 
        Cor5 = COR5_CMOE;
 
        /*
-       ** Set to monitor tbusy/tstop (or not).
-       */
+        ** Set to monitor tbusy/tstop (or not).
+        */
 
        if (PortP->MonitorTstate)
                Cor5 |= COR5_TSTATE_ON;
@@ -453,182 +442,195 @@ int SleepFlag;
                Cor5 |= COR5_TSTATE_OFF;
 
        /*
-       ** Could set LNE here if you wanted LNext processing. SVR4 will use it.
-       */
-       if ( TtyP->termios->c_iflag & ISTRIP ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Strip input characters\n");
-               if (! (PortP->State & RIO_TRIAD_MODE)) {
+        ** Could set LNE here if you wanted LNext processing. SVR4 will use it.
+        */
+       if (TtyP->termios->c_iflag & ISTRIP) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Strip input characters\n");
+               if (!(PortP->State & RIO_TRIAD_MODE)) {
                        Cor5 |= COR5_ISTRIP;
                }
        }
 
-       if ( TtyP->termios->c_oflag & ONLCR ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n");
-               if ( PortP->CookMode == COOK_MEDIUM )
+       if (TtyP->termios->c_oflag & ONLCR) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Map newline to carriage-return, newline on output\n");
+               if (PortP->CookMode == COOK_MEDIUM)
                        Cor5 |= COR5_ONLCR;
        }
-       if ( TtyP->termios->c_oflag & OCRNL ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Map carriage return to newline on output\n");
-               if ( PortP->CookMode == COOK_MEDIUM )
+       if (TtyP->termios->c_oflag & OCRNL) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Map carriage return to newline on output\n");
+               if (PortP->CookMode == COOK_MEDIUM)
                        Cor5 |= COR5_OCRNL;
        }
-       if ( ( TtyP->termios->c_oflag & TABDLY) == TAB3 ) {
-               rio_dprintk (RIO_DEBUG_PARAM, "Tab delay 3 set\n");
-               if ( PortP->CookMode == COOK_MEDIUM )
+       if ((TtyP->termios->c_oflag & TABDLY) == TAB3) {
+               rio_dprintk(RIO_DEBUG_PARAM, "Tab delay 3 set\n");
+               if (PortP->CookMode == COOK_MEDIUM)
                        Cor5 |= COR5_TAB3;
        }
 
        /*
-       ** Flow control bytes.
-       */
+        ** Flow control bytes.
+        */
        TxXon = TtyP->termios->c_cc[VSTART];
        TxXoff = TtyP->termios->c_cc[VSTOP];
        RxXon = TtyP->termios->c_cc[VSTART];
        RxXoff = TtyP->termios->c_cc[VSTOP];
        /*
-       ** LNEXT byte
-       */
+        ** LNEXT byte
+        */
        LNext = 0;
 
        /*
-       ** Baud rate bytes
-       */
-       rio_dprintk (RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", 
-                                    TtyP->termios->c_cflag, CBAUD);
+        ** Baud rate bytes
+        */
+       rio_dprintk(RIO_DEBUG_PARAM, "Mapping of rx/tx baud %x (%x)\n", TtyP->termios->c_cflag, CBAUD);
 
        switch (TtyP->termios->c_cflag & CBAUD) {
 #define e(b) case B ## b : RxBaud = TxBaud = RIO_B ## b ;break
-         e(50);e(75);e(110);e(134);e(150);e(200);e(300);e(600);e(1200);
-         e(1800);e(2400);e(4800);e(9600);e(19200);e(38400);e(57600);
-         e(115200); /* e(230400);e(460800); e(921600);  */
+               e(50);
+               e(75);
+               e(110);
+               e(134);
+               e(150);
+               e(200);
+               e(300);
+               e(600);
+               e(1200);
+               e(1800);
+               e(2400);
+               e(4800);
+               e(9600);
+               e(19200);
+               e(38400);
+               e(57600);
+               e(115200);      /* e(230400);e(460800); e(921600);  */
        }
 
        /* XXX MIssing conversion table. XXX */
-       /*       (TtyP->termios->c_cflag & V_CBAUD); */
+       /*       (TtyP->termios->c_cflag & V_CBAUD); */
 
-       rio_dprintk (RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud);
+       rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud);
 
 
        /*
-       ** Leftovers
-       */
-       if ( TtyP->termios->c_cflag & CREAD )
-               rio_dprintk (RIO_DEBUG_PARAM, "Enable receiver\n");
+        ** Leftovers
+        */
+       if (TtyP->termios->c_cflag & CREAD)
+               rio_dprintk(RIO_DEBUG_PARAM, "Enable receiver\n");
 #ifdef RCV1EN
-       if ( TtyP->termios->c_cflag & RCV1EN )
-               rio_dprintk (RIO_DEBUG_PARAM, "RCV1EN (?)\n");
+       if (TtyP->termios->c_cflag & RCV1EN)
+               rio_dprintk(RIO_DEBUG_PARAM, "RCV1EN (?)\n");
 #endif
 #ifdef XMT1EN
-       if ( TtyP->termios->c_cflag & XMT1EN )
-               rio_dprintk (RIO_DEBUG_PARAM, "XMT1EN (?)\n");
+       if (TtyP->termios->c_cflag & XMT1EN)
+               rio_dprintk(RIO_DEBUG_PARAM, "XMT1EN (?)\n");
 #endif
 #if 0
-       if ( TtyP->termios->c_cflag & LOBLK )
-               rio_dprintk (RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n");
+       if (TtyP->termios->c_cflag & LOBLK)
+               rio_dprintk(RIO_DEBUG_PARAM, "LOBLK - JCL output blocks when not current\n");
 #endif
-       if ( TtyP->termios->c_lflag & ISIG )
-               rio_dprintk (RIO_DEBUG_PARAM, "Input character signal generating enabled\n");
-       if ( TtyP->termios->c_lflag & ICANON )
-               rio_dprintk (RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n");
-       if ( TtyP->termios->c_lflag & XCASE )
-               rio_dprintk (RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n");
-       if ( TtyP->termios->c_lflag & ECHO )
-               rio_dprintk (RIO_DEBUG_PARAM, "Enable input echo\n");
-       if ( TtyP->termios->c_lflag & ECHOE )
-               rio_dprintk (RIO_DEBUG_PARAM, "Enable echo erase\n");
-       if ( TtyP->termios->c_lflag & ECHOK )
-               rio_dprintk (RIO_DEBUG_PARAM, "Enable echo kill\n");
-       if ( TtyP->termios->c_lflag & ECHONL )
-               rio_dprintk (RIO_DEBUG_PARAM, "Enable echo newline\n");
-       if ( TtyP->termios->c_lflag & NOFLSH )
-               rio_dprintk (RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n");
+       if (TtyP->termios->c_lflag & ISIG)
+               rio_dprintk(RIO_DEBUG_PARAM, "Input character signal generating enabled\n");
+       if (TtyP->termios->c_lflag & ICANON)
+               rio_dprintk(RIO_DEBUG_PARAM, "Canonical input: erase and kill enabled\n");
+       if (TtyP->termios->c_lflag & XCASE)
+               rio_dprintk(RIO_DEBUG_PARAM, "Canonical upper/lower presentation\n");
+       if (TtyP->termios->c_lflag & ECHO)
+               rio_dprintk(RIO_DEBUG_PARAM, "Enable input echo\n");
+       if (TtyP->termios->c_lflag & ECHOE)
+               rio_dprintk(RIO_DEBUG_PARAM, "Enable echo erase\n");
+       if (TtyP->termios->c_lflag & ECHOK)
+               rio_dprintk(RIO_DEBUG_PARAM, "Enable echo kill\n");
+       if (TtyP->termios->c_lflag & ECHONL)
+               rio_dprintk(RIO_DEBUG_PARAM, "Enable echo newline\n");
+       if (TtyP->termios->c_lflag & NOFLSH)
+               rio_dprintk(RIO_DEBUG_PARAM, "Disable flush after interrupt or quit\n");
 #ifdef TOSTOP
-       if ( TtyP->termios->c_lflag & TOSTOP )
-               rio_dprintk (RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n");
+       if (TtyP->termios->c_lflag & TOSTOP)
+               rio_dprintk(RIO_DEBUG_PARAM, "Send SIGTTOU for background output\n");
 #endif
 #ifdef XCLUDE
-       if ( TtyP->termios->c_lflag & XCLUDE )
-               rio_dprintk (RIO_DEBUG_PARAM, "Exclusive use of this line\n");
+       if (TtyP->termios->c_lflag & XCLUDE)
+               rio_dprintk(RIO_DEBUG_PARAM, "Exclusive use of this line\n");
 #endif
-       if ( TtyP->termios->c_iflag & IUCLC )
-               rio_dprintk (RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n");
-       if ( TtyP->termios->c_oflag & OPOST )
-               rio_dprintk (RIO_DEBUG_PARAM, "Enable output post-processing\n");
-       if ( TtyP->termios->c_oflag & OLCUC )
-               rio_dprintk (RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n");
-       if ( TtyP->termios->c_oflag & ONOCR )
-               rio_dprintk (RIO_DEBUG_PARAM, "No carriage return output at column 0\n");
-       if ( TtyP->termios->c_oflag & ONLRET )
-               rio_dprintk (RIO_DEBUG_PARAM, "Newline performs carriage return function\n");
-       if ( TtyP->termios->c_oflag & OFILL )
-               rio_dprintk (RIO_DEBUG_PARAM, "Use fill characters for delay\n");
-       if ( TtyP->termios->c_oflag & OFDEL )
-               rio_dprintk (RIO_DEBUG_PARAM, "Fill character is DEL\n");
-       if ( TtyP->termios->c_oflag & NLDLY )
-               rio_dprintk (RIO_DEBUG_PARAM, "Newline delay set\n");
-       if ( TtyP->termios->c_oflag & CRDLY )
-               rio_dprintk (RIO_DEBUG_PARAM, "Carriage return delay set\n");
-       if ( TtyP->termios->c_oflag & TABDLY )
-               rio_dprintk (RIO_DEBUG_PARAM, "Tab delay set\n");
+       if (TtyP->termios->c_iflag & IUCLC)
+               rio_dprintk(RIO_DEBUG_PARAM, "Map uppercase to lowercase on input\n");
+       if (TtyP->termios->c_oflag & OPOST)
+               rio_dprintk(RIO_DEBUG_PARAM, "Enable output post-processing\n");
+       if (TtyP->termios->c_oflag & OLCUC)
+               rio_dprintk(RIO_DEBUG_PARAM, "Map lowercase to uppercase on output\n");
+       if (TtyP->termios->c_oflag & ONOCR)
+               rio_dprintk(RIO_DEBUG_PARAM, "No carriage return output at column 0\n");
+       if (TtyP->termios->c_oflag & ONLRET)
+               rio_dprintk(RIO_DEBUG_PARAM, "Newline performs carriage return function\n");
+       if (TtyP->termios->c_oflag & OFILL)
+               rio_dprintk(RIO_DEBUG_PARAM, "Use fill characters for delay\n");
+       if (TtyP->termios->c_oflag & OFDEL)
+               rio_dprintk(RIO_DEBUG_PARAM, "Fill character is DEL\n");
+       if (TtyP->termios->c_oflag & NLDLY)
+               rio_dprintk(RIO_DEBUG_PARAM, "Newline delay set\n");
+       if (TtyP->termios->c_oflag & CRDLY)
+               rio_dprintk(RIO_DEBUG_PARAM, "Carriage return delay set\n");
+       if (TtyP->termios->c_oflag & TABDLY)
+               rio_dprintk(RIO_DEBUG_PARAM, "Tab delay set\n");
 #if 0
-       if ( TtyP->termios->c_oflag & BSDLY )
-               rio_dprintk (RIO_DEBUG_PARAM, "Back-space delay set\n");
-       if ( TtyP->termios->c_oflag & VTDLY )
-               rio_dprintk (RIO_DEBUG_PARAM, "Vertical tab delay set\n");
-       if ( TtyP->termios->c_oflag & FFDLY )
-               rio_dprintk (RIO_DEBUG_PARAM, "Form-feed delay set\n");
+       if (TtyP->termios->c_oflag & BSDLY)
+               rio_dprintk(RIO_DEBUG_PARAM, "Back-space delay set\n");
+       if (TtyP->termios->c_oflag & VTDLY)
+               rio_dprintk(RIO_DEBUG_PARAM, "Vertical tab delay set\n");
+       if (TtyP->termios->c_oflag & FFDLY)
+               rio_dprintk(RIO_DEBUG_PARAM, "Form-feed delay set\n");
 #endif
        /*
-       ** These things are kind of useful in a later life!
-       */
+        ** These things are kind of useful in a later life!
+        */
        PortP->Cor2Copy = Cor2;
 
-       if ( PortP->State & RIO_DELETED ) {
-               rio_spin_unlock_irqrestore( &PortP->portSem, flags);
-               func_exit ();
+       if (PortP->State & RIO_DELETED) {
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               func_exit();
 
                return RIO_FAIL;
        }
 
        /*
-       ** Actually write the info into the packet to be sent
-       */
-       WBYTE(phb_param_ptr->Cmd,       cmd);
-       WBYTE(phb_param_ptr->Cor1,       Cor1);
-       WBYTE(phb_param_ptr->Cor2,       Cor2);
-       WBYTE(phb_param_ptr->Cor4,       Cor4);
-       WBYTE(phb_param_ptr->Cor5,       Cor5);
-       WBYTE(phb_param_ptr->TxXon,     TxXon);
-       WBYTE(phb_param_ptr->RxXon,     RxXon);
+        ** Actually write the info into the packet to be sent
+        */
+       WBYTE(phb_param_ptr->Cmd, cmd);
+       WBYTE(phb_param_ptr->Cor1, Cor1);
+       WBYTE(phb_param_ptr->Cor2, Cor2);
+       WBYTE(phb_param_ptr->Cor4, Cor4);
+       WBYTE(phb_param_ptr->Cor5, Cor5);
+       WBYTE(phb_param_ptr->TxXon, TxXon);
+       WBYTE(phb_param_ptr->RxXon, RxXon);
        WBYTE(phb_param_ptr->TxXoff, TxXoff);
        WBYTE(phb_param_ptr->RxXoff, RxXoff);
-       WBYTE(phb_param_ptr->LNext,     LNext);
+       WBYTE(phb_param_ptr->LNext, LNext);
        WBYTE(phb_param_ptr->TxBaud, TxBaud);
        WBYTE(phb_param_ptr->RxBaud, RxBaud);
 
        /*
-       ** Set the length/command field
-       */
-       WBYTE(PacketP->len , 12 | PKT_CMD_BIT);
+        ** Set the length/command field
+        */
+       WBYTE(PacketP->len, 12 | PKT_CMD_BIT);
 
        /*
-       ** The packet is formed - now, whack it off
-       ** to its final destination:
-       */
+        ** The packet is formed - now, whack it off
+        ** to its final destination:
+        */
        add_transmit(PortP);
        /*
-       ** Count characters transmitted for port statistics reporting
-       */
+        ** Count characters transmitted for port statistics reporting
+        */
        if (PortP->statsGather)
                PortP->txchars += 12;
 
-       rio_spin_unlock_irqrestore( &PortP->portSem, flags);
+       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
 
-       rio_dprintk (RIO_DEBUG_PARAM, "add_transmit returned.\n");
+       rio_dprintk(RIO_DEBUG_PARAM, "add_transmit returned.\n");
        /*
-       ** job done.
-       */
-       func_exit ();
+        ** job done.
+        */
+       func_exit();
 
        return RIO_SUCCESS;
 }
@@ -638,16 +640,15 @@ int SleepFlag;
 ** We can add another packet to a transmit queue if the packet pointer pointed
 ** to by the TxAdd pointer has PKT_IN_USE clear in its address.
 */
-int
-can_add_transmit(PktP, PortP)
+int can_add_transmit(PktP, PortP)
 PKT **PktP;
-struct Port *PortP; 
+struct Port *PortP;
 {
        register PKT *tp;
 
-       *PktP = tp = (PKT *)RIO_PTR(PortP->Caddr,RWORD(*PortP->TxAdd));
+       *PktP = tp = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->TxAdd));
 
-       return !((uint)tp & PKT_IN_USE);
+       return !((uint) tp & PKT_IN_USE);
 }
 
 /*
@@ -655,25 +656,22 @@ struct Port *PortP;
 ** and then move the TxAdd pointer along one position to point to the next
 ** packet pointer. You must wrap the pointer from the end back to the start.
 */
-void
-add_transmit(PortP)
-struct Port *PortP; 
+void add_transmit(PortP)
+struct Port *PortP;
 {
-  if (RWORD(*PortP->TxAdd) & PKT_IN_USE) {
-    rio_dprintk (RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!");
-  }
-       WWORD( *(ushort *)PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE);
-       PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : 
-                                       PortP->TxAdd + 1;
-       WWORD( PortP->PhbP->tx_add , RIO_OFF(PortP->Caddr,PortP->TxAdd) );
+       if (RWORD(*PortP->TxAdd) & PKT_IN_USE) {
+               rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!");
+       }
+       WWORD(*(ushort *) PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE);
+       PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1;
+       WWORD(PortP->PhbP->tx_add, RIO_OFF(PortP->Caddr, PortP->TxAdd));
 }
 
 /****************************************
  * Put a packet onto the end of the
  * free list
  ****************************************/
-void
-put_free_end(HostP, PktP)
+void put_free_end(HostP, PktP)
 struct Host *HostP;
 PKT *PktP;
 {
@@ -688,24 +686,23 @@ PKT *PktP;
        *
        ************************************************/
 
-       rio_dprintk (RIO_DEBUG_PFE,  "put_free_end(PktP=%x)\n",(int)PktP);
+       rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n", (int) PktP);
 
-       if ((old_end=RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) {
-               new_end = RIO_OFF(HostP->Caddr,PktP);
-               tmp_pointer = (FREE_LIST *)RIO_PTR(HostP->Caddr,old_end);
-               WWORD(tmp_pointer->next , new_end );
-               WWORD(((FREE_LIST *)PktP)->prev , old_end);
-               WWORD(((FREE_LIST *)PktP)->next , TPNULL);
+       if ((old_end = RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) {
+               new_end = RIO_OFF(HostP->Caddr, PktP);
+               tmp_pointer = (FREE_LIST *) RIO_PTR(HostP->Caddr, old_end);
+               WWORD(tmp_pointer->next, new_end);
+               WWORD(((FREE_LIST *) PktP)->prev, old_end);
+               WWORD(((FREE_LIST *) PktP)->next, TPNULL);
                WWORD(HostP->ParmMapP->free_list_end, new_end);
-       }
-       else {  /* First packet on the free list this should never happen! */
-               rio_dprintk (RIO_DEBUG_PFE, "put_free_end(): This should never happen\n");
-               WWORD(HostP->ParmMapP->free_list_end , RIO_OFF(HostP->Caddr,PktP));
-               tmp_pointer = (FREE_LIST *)PktP;
-               WWORD(tmp_pointer->prev , TPNULL);
-               WWORD(tmp_pointer->next , TPNULL);
-       }
-       rio_dprintk (RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock);
+       } else {                /* First packet on the free list this should never happen! */
+               rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n");
+               WWORD(HostP->ParmMapP->free_list_end, RIO_OFF(HostP->Caddr, PktP));
+               tmp_pointer = (FREE_LIST *) PktP;
+               WWORD(tmp_pointer->prev, TPNULL);
+               WWORD(tmp_pointer->next, TPNULL);
+       }
+       rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock);
        rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
 }
 
@@ -715,14 +712,12 @@ PKT *PktP;
 ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear,
 ** then can_remove_receive() returns 0.
 */
-int
-can_remove_receive(PktP, PortP)
+int can_remove_receive(PktP, PortP)
 PKT **PktP;
 struct Port *PortP;
 {
-       if ( RWORD(*PortP->RxRemove) & PKT_IN_USE) {
-               *PktP = (PKT *)RIO_PTR(PortP->Caddr,
-                                       RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
+       if (RWORD(*PortP->RxRemove) & PKT_IN_USE) {
+               *PktP = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
                return 1;
        }
        return 0;
@@ -733,12 +728,10 @@ struct Port *PortP;
 ** and then bump the pointers. Once the pointers get to the end, they must
 ** be wrapped back to the start.
 */
-void
-remove_receive(PortP)
-struct Port *PortP; 
+void remove_receive(PortP)
+struct Port *PortP;
 {
-       WWORD( *PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE );
-       PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : 
-                                                               PortP->RxRemove + 1;
-       WWORD( PortP->PhbP->rx_remove , RIO_OFF(PortP->Caddr, PortP->RxRemove) );
+       WWORD(*PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
+       PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1;
+       WWORD(PortP->PhbP->rx_remove, RIO_OFF(PortP->Caddr, PortP->RxRemove));
 }
index 2ea99a60aa326a899d9574c9d727b934be4e9482..535afaa51ca581274757b92f1000bf8e0ebc2ccf 100644 (file)
@@ -1,8 +1,8 @@
 
 /* Yeah. We have copyright on this one. Sure. */
 
-void rio_pcicopy( char *from, char *to, int amount)
+void rio_pcicopy(char *from, char *to, int amount)
 {
-  while ( amount-- )
-    *to++ = *from++;
+       while (amount--)
+               *to++ = *from++;
 }
index e9564c9fb37c339855840cced9c3c885524125de..0f4cd33ba641764ae79e63e421f57fd87762a4f5 100644 (file)
@@ -93,625 +93,517 @@ static void RIOConCon(struct rio_info *, struct Host *, uint, uint, uint, uint,
 ** Incoming on the ROUTE_RUP
 ** I wrote this while I was tired. Forgive me.
 */
-int RIORouteRup( struct rio_info *p, uint Rup, struct Host *HostP, PKT *PacketP )
+int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP)
 {
-  struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data;
-  struct PktCmd_M *PktReplyP;
-  struct CmdBlk *CmdBlkP;
-  struct Port *PortP;
-  struct Map *MapP;
-  struct Top *TopP;
-  int ThisLink, ThisLinkMin, ThisLinkMax;
-  int port;
-  int Mod, Mod1, Mod2;
-  ushort RtaType;
-  uint RtaUniq;
-  uint ThisUnit, ThisUnit2;    /* 2 ids to accommodate 16 port RTA */
-  uint OldUnit, NewUnit, OldLink, NewLink;
-  char *MyType, *MyName;
-  int Lies;
-  unsigned long flags;
+       struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data;
+       struct PktCmd_M *PktReplyP;
+       struct CmdBlk *CmdBlkP;
+       struct Port *PortP;
+       struct Map *MapP;
+       struct Top *TopP;
+       int ThisLink, ThisLinkMin, ThisLinkMax;
+       int port;
+       int Mod, Mod1, Mod2;
+       ushort RtaType;
+       uint RtaUniq;
+       uint ThisUnit, ThisUnit2;       /* 2 ids to accommodate 16 port RTA */
+       uint OldUnit, NewUnit, OldLink, NewLink;
+       char *MyType, *MyName;
+       int Lies;
+       unsigned long flags;
 
 #ifdef STACK
-    RIOStackCheck("RIORouteRup");
+       RIOStackCheck("RIORouteRup");
 #endif
 #ifdef CHECK
-    CheckPacketP(PacketP);
-    CheckHostP(HostP);
-    CheckRup(Rup);
-    CheckHost(Host);
+       CheckPacketP(PacketP);
+       CheckHostP(HostP);
+       CheckRup(Rup);
+       CheckHost(Host);
 #endif
-  /*
-  ** Is this unit telling us it's current link topology?
-  */
-  if ( RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY )
-  {
-    MapP = HostP->Mapping;
-
-    /*
-    ** The packet can be sent either by the host or by an RTA.
-    ** If it comes from the host, then we need to fill in the
-    ** Topology array in the host structure. If it came in
-    ** from an RTA then we need to fill in the Mapping structure's
-    ** Topology array for the unit.
-    */
-    if ( Rup >= (ushort)MAX_RUP )
-    {
-      ThisUnit = HOST_ID;
-      TopP = HostP->Topology;
-      MyType = "Host";
-      MyName = HostP->Name;
-      ThisLinkMin = ThisLinkMax = Rup - MAX_RUP;
-    }
-    else
-    {
-      ThisUnit = Rup+1;
-      TopP = HostP->Mapping[Rup].Topology;
-      MyType = "RTA";
-      MyName = HostP->Mapping[Rup].Name;
-      ThisLinkMin = 0;
-      ThisLinkMax = LINKS_PER_UNIT - 1;
-    }
-
-    /*
-    ** Lies will not be tolerated.
-    ** If any pair of links claim to be connected to the same
-    ** place, then ignore this packet completely.
-    */
-    Lies = 0;
-    for ( ThisLink=ThisLinkMin + 1; ThisLink <= ThisLinkMax; ThisLink++)
-    {
-      /*
-      ** it won't lie about network interconnect, total disconnects
-      ** and no-IDs. (or at least, it doesn't *matter* if it does)
-      */
-      if ( RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort)MAX_RUP )
-         continue;
-
-      for ( NewLink=ThisLinkMin; NewLink < ThisLink; NewLink++ )
-      {
-        if ( (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) ==
-              RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) &&
-            (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) ==
-              RBYTE(PktCmdP->RouteTopology[NewLink].Link)) )
-       {
-          Lies++;
-       }
-      }
-    }
-
-    if ( Lies )
-    {
-      rio_dprintk (RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n",Lies);
-      rio_dprintk (RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n",
-          RBYTE(PktCmdP->RouteTopology[0].Unit), 
-         'A'+RBYTE(PktCmdP->RouteTopology[0].Link),
-          RBYTE(PktCmdP->RouteTopology[1].Unit),
-         'A'+RBYTE(PktCmdP->RouteTopology[1].Link),
-          RBYTE(PktCmdP->RouteTopology[2].Unit),
-         'A'+RBYTE(PktCmdP->RouteTopology[2].Link),
-          RBYTE(PktCmdP->RouteTopology[3].Unit),
-         'A'+RBYTE(PktCmdP->RouteTopology[3].Link));
-      return TRUE;
-    }
-
-    /*
-    ** now, process each link.
-    */
-    for ( ThisLink=ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++)
-    {
-      /*
-      ** this is what it was connected to
-      */
-      OldUnit = TopP[ThisLink].Unit;
-      OldLink = TopP[ThisLink].Link;
-
-      /*
-      ** this is what it is now connected to
-      */
-      NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit);
-      NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link);
-
-      if ( OldUnit != NewUnit || OldLink != NewLink )
-      {
        /*
-       ** something has changed!
-       */
-
-        if ( NewUnit > MAX_RUP &&
-            NewUnit != ROUTE_DISCONNECT &&
-            NewUnit != ROUTE_NO_ID &&
-            NewUnit != ROUTE_INTERCONNECT )
-       {
-           rio_dprintk (RIO_DEBUG_ROUTE, "I have a link from %s %s to unit %d:%d - I don't like it.\n",
-                 MyType,
-                 MyName,
-                 NewUnit,
-                 NewLink);
-       }
-       else
-       {
-         /*
-         ** put the new values in
-         */
-         TopP[ThisLink].Unit = NewUnit;
-         TopP[ThisLink].Link = NewLink;
-
-         RIOSetChange(p);
-
-         if ( OldUnit <= MAX_RUP )
-         {
-           /*
-           ** If something has become bust, then re-enable them messages
-           */
-           if (! p->RIONoMessage)
-               RIOConCon(p,HostP,ThisUnit,ThisLink,OldUnit,OldLink,DISCONNECT);
-         }
-
-         if ( ( NewUnit <= MAX_RUP ) && !p->RIONoMessage )
-           RIOConCon(p,HostP,ThisUnit,ThisLink,NewUnit,NewLink,CONNECT);
-
-         if ( NewUnit == ROUTE_NO_ID )
-           rio_dprintk (RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n",
-                   MyType,MyName,'A'+ThisLink);
-
-         if ( NewUnit == ROUTE_INTERCONNECT )
-         {
-           if (! p->RIONoMessage)
-               cprintf("%s '%s' (%c) is connected to another network.\n", MyType,MyName,'A'+ThisLink);
-         }
-
-         /*
-         ** perform an update for 'the other end', so that these messages
-         ** only appears once. Only disconnect the other end if it is pointing
-         ** at us!
-         */
-         if ( OldUnit == HOST_ID )
-         {
-           if ( HostP->Topology[OldLink].Unit == ThisUnit &&
-                HostP->Topology[OldLink].Link == ThisLink )
-           {
-             rio_dprintk (RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink+'A');
-             HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT;
-             HostP->Topology[OldLink].Link = NO_LINK;
-           }
-           else
-           {
-             rio_dprintk (RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n",
-                   OldLink+'A',HostP->Mapping[ThisUnit-1].Name,ThisLink+'A');
-           }
-         }
-         else if ( OldUnit <= MAX_RUP )
-         {
-           if ( HostP->Mapping[OldUnit-1].Topology[OldLink].Unit == ThisUnit &&
-                HostP->Mapping[OldUnit-1].Topology[OldLink].Link == ThisLink )
-           {
-             rio_dprintk (RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n",
-                                  HostP->Mapping[OldUnit-1].Name,OldLink+'A');
-             HostP->Mapping[OldUnit-1].Topology[OldLink].Unit=ROUTE_DISCONNECT;
-             HostP->Mapping[OldUnit-1].Topology[OldLink].Link=NO_LINK;
-           }
-           else
-           {
-             rio_dprintk (RIO_DEBUG_ROUTE, "RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n",
-                           HostP->Mapping[OldUnit-1].Name,OldLink+'A',
-                           HostP->Mapping[ThisUnit-1].Name,ThisLink+'A');
-           }
-         }
-         if ( NewUnit == HOST_ID )
-         {
-           rio_dprintk (RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n",
-                               NewLink+'A',MyName,ThisLink+'A');
-           HostP->Topology[NewLink].Unit = ThisUnit;
-           HostP->Topology[NewLink].Link = ThisLink;
-         }
-         else if ( NewUnit <= MAX_RUP )
-         {
-           rio_dprintk (RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n",
-             HostP->Mapping[NewUnit-1].Name,NewLink+'A',MyName,ThisLink+'A');
-           HostP->Mapping[NewUnit-1].Topology[NewLink].Unit=ThisUnit;
-           HostP->Mapping[NewUnit-1].Topology[NewLink].Link=ThisLink;
-         }
+        ** Is this unit telling us it's current link topology?
+        */
+       if (RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY) {
+               MapP = HostP->Mapping;
+
+               /*
+                ** The packet can be sent either by the host or by an RTA.
+                ** If it comes from the host, then we need to fill in the
+                ** Topology array in the host structure. If it came in
+                ** from an RTA then we need to fill in the Mapping structure's
+                ** Topology array for the unit.
+                */
+               if (Rup >= (ushort) MAX_RUP) {
+                       ThisUnit = HOST_ID;
+                       TopP = HostP->Topology;
+                       MyType = "Host";
+                       MyName = HostP->Name;
+                       ThisLinkMin = ThisLinkMax = Rup - MAX_RUP;
+               } else {
+                       ThisUnit = Rup + 1;
+                       TopP = HostP->Mapping[Rup].Topology;
+                       MyType = "RTA";
+                       MyName = HostP->Mapping[Rup].Name;
+                       ThisLinkMin = 0;
+                       ThisLinkMax = LINKS_PER_UNIT - 1;
+               }
+
+               /*
+                ** Lies will not be tolerated.
+                ** If any pair of links claim to be connected to the same
+                ** place, then ignore this packet completely.
+                */
+               Lies = 0;
+               for (ThisLink = ThisLinkMin + 1; ThisLink <= ThisLinkMax; ThisLink++) {
+                       /*
+                        ** it won't lie about network interconnect, total disconnects
+                        ** and no-IDs. (or at least, it doesn't *matter* if it does)
+                        */
+                       if (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP)
+                               continue;
+
+                       for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) {
+                               if ((RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) == RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) && (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) == RBYTE(PktCmdP->RouteTopology[NewLink].Link))) {
+                                       Lies++;
+                               }
+                       }
+               }
+
+               if (Lies) {
+                       rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies);
+                       rio_dprintk(RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n",
+                                   RBYTE(PktCmdP->RouteTopology[0].Unit),
+                                   'A' + RBYTE(PktCmdP->RouteTopology[0].Link),
+                                   RBYTE(PktCmdP->RouteTopology[1].Unit),
+                                   'A' + RBYTE(PktCmdP->RouteTopology[1].Link), RBYTE(PktCmdP->RouteTopology[2].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[2].Link), RBYTE(PktCmdP->RouteTopology[3].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[3].Link));
+                       return TRUE;
+               }
+
+               /*
+                ** now, process each link.
+                */
+               for (ThisLink = ThisLinkMin; ThisLink <= ThisLinkMax; ThisLink++) {
+                       /*
+                        ** this is what it was connected to
+                        */
+                       OldUnit = TopP[ThisLink].Unit;
+                       OldLink = TopP[ThisLink].Link;
+
+                       /*
+                        ** this is what it is now connected to
+                        */
+                       NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit);
+                       NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link);
+
+                       if (OldUnit != NewUnit || OldLink != NewLink) {
+                               /*
+                                ** something has changed!
+                                */
+
+                               if (NewUnit > MAX_RUP && NewUnit != ROUTE_DISCONNECT && NewUnit != ROUTE_NO_ID && NewUnit != ROUTE_INTERCONNECT) {
+                                       rio_dprintk(RIO_DEBUG_ROUTE, "I have a link from %s %s to unit %d:%d - I don't like it.\n", MyType, MyName, NewUnit, NewLink);
+                               } else {
+                                       /*
+                                        ** put the new values in
+                                        */
+                                       TopP[ThisLink].Unit = NewUnit;
+                                       TopP[ThisLink].Link = NewLink;
+
+                                       RIOSetChange(p);
+
+                                       if (OldUnit <= MAX_RUP) {
+                                               /*
+                                                ** If something has become bust, then re-enable them messages
+                                                */
+                                               if (!p->RIONoMessage)
+                                                       RIOConCon(p, HostP, ThisUnit, ThisLink, OldUnit, OldLink, DISCONNECT);
+                                       }
+
+                                       if ((NewUnit <= MAX_RUP) && !p->RIONoMessage)
+                                               RIOConCon(p, HostP, ThisUnit, ThisLink, NewUnit, NewLink, CONNECT);
+
+                                       if (NewUnit == ROUTE_NO_ID)
+                                               rio_dprintk(RIO_DEBUG_ROUTE, "%s %s (%c) is connected to an unconfigured unit.\n", MyType, MyName, 'A' + ThisLink);
+
+                                       if (NewUnit == ROUTE_INTERCONNECT) {
+                                               if (!p->RIONoMessage)
+                                                       cprintf("%s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink);
+                                       }
+
+                                       /*
+                                        ** perform an update for 'the other end', so that these messages
+                                        ** only appears once. Only disconnect the other end if it is pointing
+                                        ** at us!
+                                        */
+                                       if (OldUnit == HOST_ID) {
+                                               if (HostP->Topology[OldLink].Unit == ThisUnit && HostP->Topology[OldLink].Link == ThisLink) {
+                                                       rio_dprintk(RIO_DEBUG_ROUTE, "SETTING HOST (%c) TO DISCONNECTED!\n", OldLink + 'A');
+                                                       HostP->Topology[OldLink].Unit = ROUTE_DISCONNECT;
+                                                       HostP->Topology[OldLink].Link = NO_LINK;
+                                               } else {
+                                                       rio_dprintk(RIO_DEBUG_ROUTE, "HOST(%c) WAS NOT CONNECTED TO %s (%c)!\n", OldLink + 'A', HostP->Mapping[ThisUnit - 1].Name, ThisLink + 'A');
+                                               }
+                                       } else if (OldUnit <= MAX_RUP) {
+                                               if (HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit == ThisUnit && HostP->Mapping[OldUnit - 1].Topology[OldLink].Link == ThisLink) {
+                                                       rio_dprintk(RIO_DEBUG_ROUTE, "SETTING RTA %s (%c) TO DISCONNECTED!\n", HostP->Mapping[OldUnit - 1].Name, OldLink + 'A');
+                                                       HostP->Mapping[OldUnit - 1].Topology[OldLink].Unit = ROUTE_DISCONNECT;
+                                                       HostP->Mapping[OldUnit - 1].Topology[OldLink].Link = NO_LINK;
+                                               } else {
+                                                       rio_dprintk(RIO_DEBUG_ROUTE, "RTA %s (%c) WAS NOT CONNECTED TO %s (%c)\n", HostP->Mapping[OldUnit - 1].Name, OldLink + 'A', HostP->Mapping[ThisUnit - 1].Name, ThisLink + 'A');
+                                               }
+                                       }
+                                       if (NewUnit == HOST_ID) {
+                                               rio_dprintk(RIO_DEBUG_ROUTE, "MARKING HOST (%c) CONNECTED TO %s (%c)\n", NewLink + 'A', MyName, ThisLink + 'A');
+                                               HostP->Topology[NewLink].Unit = ThisUnit;
+                                               HostP->Topology[NewLink].Link = ThisLink;
+                                       } else if (NewUnit <= MAX_RUP) {
+                                               rio_dprintk(RIO_DEBUG_ROUTE, "MARKING RTA %s (%c) CONNECTED TO %s (%c)\n", HostP->Mapping[NewUnit - 1].Name, NewLink + 'A', MyName, ThisLink + 'A');
+                                               HostP->Mapping[NewUnit - 1].Topology[NewLink].Unit = ThisUnit;
+                                               HostP->Mapping[NewUnit - 1].Topology[NewLink].Link = ThisLink;
+                                       }
+                               }
+                               RIOSetChange(p);
+                               RIOCheckIsolated(p, HostP, OldUnit);
+                       }
+               }
+               return TRUE;
        }
-       RIOSetChange(p);
-       RIOCheckIsolated(p, HostP, OldUnit );
-      }
-    }
-    return TRUE;
-  }
-
-  /*
-  ** The only other command we recognise is a route_request command
-  */
-  if ( RBYTE(PktCmdP->Command) != ROUTE_REQUEST )
-  {
-    rio_dprintk (RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", 
-          RBYTE(PktCmdP->Command),Rup,(int)HostP);
-    return TRUE;
-  }
-      
-  RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) +
-           (RBYTE(PktCmdP->UniqNum[1]) << 8) +
-           (RBYTE(PktCmdP->UniqNum[2]) << 16) +
-           (RBYTE(PktCmdP->UniqNum[3]) << 24);
-
-  /*
-  ** Determine if 8 or 16 port RTA
-  */
-  RtaType = GetUnitType(RtaUniq);
-
-  rio_dprintk (RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq);
-
-  Mod = RBYTE(PktCmdP->ModuleTypes);
-  Mod1 = LONYBLE(Mod);
-  if (RtaType == TYPE_RTA16)
-  {
-    /*
-    ** Only one ident is set for a 16 port RTA. To make compatible
-    ** with 8 port, set 2nd ident in Mod2 to the same as Mod1.
-    */
-    Mod2 = Mod1;
-    rio_dprintk (RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n",
-     p->RIOModuleTypes[Mod1].Name);
-  }
-  else
-  {
-    Mod2 = HINYBLE(Mod);
-    rio_dprintk (RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n",
-     p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name);
-  }
-
-  if ( RtaUniq == 0xffffffff )
-  {
-      ShowPacket( DBG_SPECIAL, PacketP );
-  }
-
-  /*
-  ** try to unhook a command block from the command free list.
-  */
-  if ( !(CmdBlkP = RIOGetCmdBlk()) )
-  {
-    rio_dprintk (RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n");
-    return 0;
-  }
-
-  /*
-  ** Fill in the default info on the command block
-  */
-  CmdBlkP->Packet.dest_unit = Rup;
-  CmdBlkP->Packet.dest_port = ROUTE_RUP;
-  CmdBlkP->Packet.src_unit = HOST_ID;
-  CmdBlkP->Packet.src_port = ROUTE_RUP;
-  CmdBlkP->Packet.len = PKT_CMD_BIT | 1;
-  CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL;
-  PktReplyP = (struct PktCmd_M *)CmdBlkP->Packet.data;
-
-  if (! RIOBootOk(p, HostP, RtaUniq))
-  {
-    rio_dprintk (RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n",
-         RtaUniq);
-    PktReplyP->Command = ROUTE_FOAD;
-    HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
-    RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
-    return TRUE;
-  }
-
-  /*
-  ** Check to see if the RTA is configured for this host
-  */
-  for ( ThisUnit=0; ThisUnit<MAX_RUP; ThisUnit++ )
-  {
-    rio_dprintk (RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n",
-                       ThisUnit,
-                       HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE ?
-                                           "Slot-In-Use":"Not In Use",
-                       HostP->Mapping[ThisUnit].Flags & SLOT_TENTATIVE ? 
-                                           "Slot-Tentative":"Not Tentative",
-                       HostP->Mapping[ThisUnit].RtaUniqueNum);
-
-    /*
-    ** We have an entry for it.
-    */
-    if ( (HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) &&
-         (HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq) )
-    {
-      if (RtaType == TYPE_RTA16)
-      {
-         ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1;
-          rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n",
-                                           RtaUniq,ThisUnit,ThisUnit2);
-      }
-      else
-          rio_dprintk (RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n",
-                                           RtaUniq,ThisUnit);
-      /*
-      ** If we have no knowledge of booting it, then the host has
-      ** been re-booted, and so we must kill the RTA, so that it
-      ** will be booted again (potentially with new bins)
-      ** and it will then re-ask for an ID, which we will service.
-      */
-      if ( (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && 
-         !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED) )
-      {
-       if ( !(HostP->Mapping[ThisUnit].Flags & MSG_DONE) )
-       {
-           if ( !p->RIONoMessage )
-               cprintf("RTA '%s' is being updated.\n",HostP->Mapping[ThisUnit].Name);
-           HostP->Mapping[ThisUnit].Flags |= MSG_DONE;
+
+       /*
+        ** The only other command we recognise is a route_request command
+        */
+       if (RBYTE(PktCmdP->Command) != ROUTE_REQUEST) {
+               rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", RBYTE(PktCmdP->Command), Rup, (int) HostP);
+               return TRUE;
        }
-       PktReplyP->Command = ROUTE_FOAD;
-       HostP->Copy("RT_FOAD",PktReplyP->CommandText,7);
-       RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
-       return TRUE;
-      }
-
-      /*
-      ** Send the ID (entry) to this RTA. The ID number is implicit as
-      ** the offset into the table. It is worth noting at this stage
-      ** that offset zero in the table contains the entries for the
-      ** RTA with ID 1!!!!
-      */
-      PktReplyP->Command = ROUTE_ALLOCATE;
-      PktReplyP->IDNum   = ThisUnit+1;
-      if (RtaType == TYPE_RTA16)
-      {
-        if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE)
-           /*
-           ** Adjust the phb and tx pkt dest_units for 2nd block of 8
-           ** only if the RTA has ports associated (SLOT_IN_USE)
-           */
-           RIOFixPhbs(p, HostP, ThisUnit2);
-           PktReplyP->IDNum2  = ThisUnit2+1;
-           rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n",
-                 HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2);
-      }
-      else
-      {
-           PktReplyP->IDNum2 = ROUTE_NO_ID;
-           rio_dprintk (RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n",
-                 HostP->Mapping[ThisUnit].Name,PktReplyP->IDNum);
-      }
-      HostP->Copy("RT_ALLOCAT",PktReplyP->CommandText,10);
-
-      RIOQueueCmdBlk( HostP, Rup, CmdBlkP);
-
-      /*
-      ** If this is a freshly booted RTA, then we need to re-open
-      ** the ports, if any where open, so that data may once more
-      ** flow around the system!
-      */
-      if ( (HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) &&
-          (HostP->Mapping[ThisUnit].SysPort != NO_PORT) )
-      {
+
+       RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24);
+
        /*
-       ** look at the ports associated with this beast and
-       ** see if any where open. If they was, then re-open
-       ** them, using the info from the tty flags.
-       */
-       for ( port=0; port<PORTS_PER_RTA; port++ )
-       {
-         PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort];
-         if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) )
-         {
-           rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n");
-           rio_spin_lock_irqsave(&PortP->portSem, flags);
-           PortP->MagicFlags |= MAGIC_REBOOT;
-           rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-         }
+        ** Determine if 8 or 16 port RTA
+        */
+       RtaType = GetUnitType(RtaUniq);
+
+       rio_dprintk(RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq);
+
+       Mod = RBYTE(PktCmdP->ModuleTypes);
+       Mod1 = LONYBLE(Mod);
+       if (RtaType == TYPE_RTA16) {
+               /*
+                ** Only one ident is set for a 16 port RTA. To make compatible
+                ** with 8 port, set 2nd ident in Mod2 to the same as Mod1.
+                */
+               Mod2 = Mod1;
+               rio_dprintk(RIO_DEBUG_ROUTE, "Backplane type is %s (all ports)\n", p->RIOModuleTypes[Mod1].Name);
+       } else {
+               Mod2 = HINYBLE(Mod);
+               rio_dprintk(RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name);
        }
-       if (RtaType == TYPE_RTA16)
-       {
-         for ( port=0; port<PORTS_PER_RTA; port++ )
-         {
-           PortP = p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort];
-           if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) )
-           {
-             rio_dprintk (RIO_DEBUG_ROUTE, "Re-opened this port\n");
-             rio_spin_lock_irqsave(&PortP->portSem, flags);
-             PortP->MagicFlags |= MAGIC_REBOOT;
-             rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-           }
-         }
+
+       if (RtaUniq == 0xffffffff) {
+               ShowPacket(DBG_SPECIAL, PacketP);
        }
-      }
-
-      /*
-      ** keep a copy of the module types!
-      */
-      HostP->UnixRups[ThisUnit].ModTypes = Mod;
-      if (RtaType == TYPE_RTA16)
-             HostP->UnixRups[ThisUnit2].ModTypes = Mod;
-
-      /*
-      ** If either of the modules on this unit is read-only or write-only
-      ** or none-xprint, then we need to transfer that info over to the
-      ** relevant ports.
-      */
-      if ( HostP->Mapping[ThisUnit].SysPort != NO_PORT )
-      {
-        for ( port=0; port<PORTS_PER_MODULE; port++ )
-       {
-         p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK;
-         p->RIOPortp[port+HostP->Mapping[ThisUnit].SysPort]->Config |=
-          p->RIOModuleTypes[Mod1].Flags[port];
-         p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK;
-         p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port];
+
+       /*
+        ** try to unhook a command block from the command free list.
+        */
+       if (!(CmdBlkP = RIOGetCmdBlk())) {
+               rio_dprintk(RIO_DEBUG_ROUTE, "No command blocks to route RTA! come back later.\n");
+               return 0;
        }
-       if (RtaType == TYPE_RTA16)
-       {
-          for ( port=0; port<PORTS_PER_MODULE; port++ )
-         {
-           p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK;
-           p->RIOPortp[port+HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port];
-           p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK;
-           p->RIOPortp[port+PORTS_PER_MODULE+HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port];
-          }
+
+       /*
+        ** Fill in the default info on the command block
+        */
+       CmdBlkP->Packet.dest_unit = Rup;
+       CmdBlkP->Packet.dest_port = ROUTE_RUP;
+       CmdBlkP->Packet.src_unit = HOST_ID;
+       CmdBlkP->Packet.src_port = ROUTE_RUP;
+       CmdBlkP->Packet.len = PKT_CMD_BIT | 1;
+       CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL;
+       PktReplyP = (struct PktCmd_M *) CmdBlkP->Packet.data;
+
+       if (!RIOBootOk(p, HostP, RtaUniq)) {
+               rio_dprintk(RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", RtaUniq);
+               PktReplyP->Command = ROUTE_FOAD;
+               HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
+               RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
+               return TRUE;
        }
-      }
-
-      /*
-      ** Job done, get on with the interrupts!
-      */
-      return TRUE;
-    }
-  }
-  /*
-  ** There is no table entry for this RTA at all.
-  **
-  ** Lets check to see if we actually booted this unit - if not,
-  ** then we reset it and it will go round the loop of being booted
-  ** we can then worry about trying to fit it into the table.
-  */
-  for ( ThisUnit=0; ThisUnit<HostP->NumExtraBooted; ThisUnit++ )
-    if ( HostP->ExtraUnits[ThisUnit] == RtaUniq )
-      break;
-  if ( ThisUnit == HostP->NumExtraBooted && ThisUnit != MAX_EXTRA_UNITS )
-  {
-    /*
-    ** if the unit wasn't in the table, and the table wasn't full, then
-    ** we reset the unit, because we didn't boot it.
-    ** However, if the table is full, it could be that we did boot
-    ** this unit, and so we won't reboot it, because it isn't really
-    ** all that disasterous to keep the old bins in most cases. This
-    ** is a rather tacky feature, but we are on the edge of reallity
-    ** here, because the implication is that someone has connected
-    ** 16+MAX_EXTRA_UNITS onto one host.
-    */
-    static int UnknownMesgDone = 0;
-
-    if ( !UnknownMesgDone )
-    {
-       if (! p->RIONoMessage)
-           cprintf("One or more unknown RTAs are being updated.\n");
-       UnknownMesgDone = 1;
-    }
-
-    PktReplyP->Command = ROUTE_FOAD;
-    HostP->Copy("RT_FOAD",PktReplyP->CommandText,7);
-  }
-  else
-  {
-    /*
-    ** we did boot it (as an extra), and there may now be a table
-    ** slot free (because of a delete), so we will try to make
-    ** a tentative entry for it, so that the configurator can see it
-    ** and fill in the details for us.
-    */
-    if (RtaType == TYPE_RTA16)
-    {
-       if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0)
-       {
-           RIODefaultName(p, HostP, ThisUnit);
-           FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP);
+
+       /*
+        ** Check to see if the RTA is configured for this host
+        */
+       for (ThisUnit = 0; ThisUnit < MAX_RUP; ThisUnit++) {
+               rio_dprintk(RIO_DEBUG_ROUTE, "Entry %d Flags=%s %s UniqueNum=0x%x\n",
+                           ThisUnit, HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE ? "Slot-In-Use" : "Not In Use", HostP->Mapping[ThisUnit].Flags & SLOT_TENTATIVE ? "Slot-Tentative" : "Not Tentative", HostP->Mapping[ThisUnit].RtaUniqueNum);
+
+               /*
+                ** We have an entry for it.
+                */
+               if ((HostP->Mapping[ThisUnit].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && (HostP->Mapping[ThisUnit].RtaUniqueNum == RtaUniq)) {
+                       if (RtaType == TYPE_RTA16) {
+                               ThisUnit2 = HostP->Mapping[ThisUnit].ID2 - 1;
+                               rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slots %d+%d\n", RtaUniq, ThisUnit, ThisUnit2);
+                       } else
+                               rio_dprintk(RIO_DEBUG_ROUTE, "Found unit 0x%x at slot %d\n", RtaUniq, ThisUnit);
+                       /*
+                        ** If we have no knowledge of booting it, then the host has
+                        ** been re-booted, and so we must kill the RTA, so that it
+                        ** will be booted again (potentially with new bins)
+                        ** and it will then re-ask for an ID, which we will service.
+                        */
+                       if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) {
+                               if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) {
+                                       if (!p->RIONoMessage)
+                                               cprintf("RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name);
+                                       HostP->Mapping[ThisUnit].Flags |= MSG_DONE;
+                               }
+                               PktReplyP->Command = ROUTE_FOAD;
+                               HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
+                               RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
+                               return TRUE;
+                       }
+
+                       /*
+                        ** Send the ID (entry) to this RTA. The ID number is implicit as
+                        ** the offset into the table. It is worth noting at this stage
+                        ** that offset zero in the table contains the entries for the
+                        ** RTA with ID 1!!!!
+                        */
+                       PktReplyP->Command = ROUTE_ALLOCATE;
+                       PktReplyP->IDNum = ThisUnit + 1;
+                       if (RtaType == TYPE_RTA16) {
+                               if (HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE)
+                                       /*
+                                        ** Adjust the phb and tx pkt dest_units for 2nd block of 8
+                                        ** only if the RTA has ports associated (SLOT_IN_USE)
+                                        */
+                                       RIOFixPhbs(p, HostP, ThisUnit2);
+                               PktReplyP->IDNum2 = ThisUnit2 + 1;
+                               rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated IDs %d+%d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum, PktReplyP->IDNum2);
+                       } else {
+                               PktReplyP->IDNum2 = ROUTE_NO_ID;
+                               rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum);
+                       }
+                       HostP->Copy("RT_ALLOCAT", PktReplyP->CommandText, 10);
+
+                       RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
+
+                       /*
+                        ** If this is a freshly booted RTA, then we need to re-open
+                        ** the ports, if any where open, so that data may once more
+                        ** flow around the system!
+                        */
+                       if ((HostP->Mapping[ThisUnit].Flags & RTA_NEWBOOT) && (HostP->Mapping[ThisUnit].SysPort != NO_PORT)) {
+                               /*
+                                ** look at the ports associated with this beast and
+                                ** see if any where open. If they was, then re-open
+                                ** them, using the info from the tty flags.
+                                */
+                               for (port = 0; port < PORTS_PER_RTA; port++) {
+                                       PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort];
+                                       if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) {
+                                               rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n");
+                                               rio_spin_lock_irqsave(&PortP->portSem, flags);
+                                               PortP->MagicFlags |= MAGIC_REBOOT;
+                                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                                       }
+                               }
+                               if (RtaType == TYPE_RTA16) {
+                                       for (port = 0; port < PORTS_PER_RTA; port++) {
+                                               PortP = p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort];
+                                               if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) {
+                                                       rio_dprintk(RIO_DEBUG_ROUTE, "Re-opened this port\n");
+                                                       rio_spin_lock_irqsave(&PortP->portSem, flags);
+                                                       PortP->MagicFlags |= MAGIC_REBOOT;
+                                                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                                               }
+                                       }
+                               }
+                       }
+
+                       /*
+                        ** keep a copy of the module types!
+                        */
+                       HostP->UnixRups[ThisUnit].ModTypes = Mod;
+                       if (RtaType == TYPE_RTA16)
+                               HostP->UnixRups[ThisUnit2].ModTypes = Mod;
+
+                       /*
+                        ** If either of the modules on this unit is read-only or write-only
+                        ** or none-xprint, then we need to transfer that info over to the
+                        ** relevant ports.
+                        */
+                       if (HostP->Mapping[ThisUnit].SysPort != NO_PORT) {
+                               for (port = 0; port < PORTS_PER_MODULE; port++) {
+                                       p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK;
+                                       p->RIOPortp[port + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port];
+                                       p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config &= ~RIO_NOMASK;
+                                       p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port];
+                               }
+                               if (RtaType == TYPE_RTA16) {
+                                       for (port = 0; port < PORTS_PER_MODULE; port++) {
+                                               p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK;
+                                               p->RIOPortp[port + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod1].Flags[port];
+                                               p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config &= ~RIO_NOMASK;
+                                               p->RIOPortp[port + PORTS_PER_MODULE + HostP->Mapping[ThisUnit2].SysPort]->Config |= p->RIOModuleTypes[Mod2].Flags[port];
+                                       }
+                               }
+                       }
+
+                       /*
+                        ** Job done, get on with the interrupts!
+                        */
+                       return TRUE;
+               }
        }
-    }
-    else
-    {
-       if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0)
-       {
-           RIODefaultName(p, HostP, ThisUnit);
-           FillSlot(ThisUnit, 0, RtaUniq, HostP);
+       /*
+        ** There is no table entry for this RTA at all.
+        **
+        ** Lets check to see if we actually booted this unit - if not,
+        ** then we reset it and it will go round the loop of being booted
+        ** we can then worry about trying to fit it into the table.
+        */
+       for (ThisUnit = 0; ThisUnit < HostP->NumExtraBooted; ThisUnit++)
+               if (HostP->ExtraUnits[ThisUnit] == RtaUniq)
+                       break;
+       if (ThisUnit == HostP->NumExtraBooted && ThisUnit != MAX_EXTRA_UNITS) {
+               /*
+                ** if the unit wasn't in the table, and the table wasn't full, then
+                ** we reset the unit, because we didn't boot it.
+                ** However, if the table is full, it could be that we did boot
+                ** this unit, and so we won't reboot it, because it isn't really
+                ** all that disasterous to keep the old bins in most cases. This
+                ** is a rather tacky feature, but we are on the edge of reallity
+                ** here, because the implication is that someone has connected
+                ** 16+MAX_EXTRA_UNITS onto one host.
+                */
+               static int UnknownMesgDone = 0;
+
+               if (!UnknownMesgDone) {
+                       if (!p->RIONoMessage)
+                               cprintf("One or more unknown RTAs are being updated.\n");
+                       UnknownMesgDone = 1;
+               }
+
+               PktReplyP->Command = ROUTE_FOAD;
+               HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7);
+       } else {
+               /*
+                ** we did boot it (as an extra), and there may now be a table
+                ** slot free (because of a delete), so we will try to make
+                ** a tentative entry for it, so that the configurator can see it
+                ** and fill in the details for us.
+                */
+               if (RtaType == TYPE_RTA16) {
+                       if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) {
+                               RIODefaultName(p, HostP, ThisUnit);
+                               FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP);
+                       }
+               } else {
+                       if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) {
+                               RIODefaultName(p, HostP, ThisUnit);
+                               FillSlot(ThisUnit, 0, RtaUniq, HostP);
+                       }
+               }
+               PktReplyP->Command = ROUTE_USED;
+               HostP->Copy("RT_USED", PktReplyP->CommandText, 7);
        }
-    }
-    PktReplyP->Command = ROUTE_USED;
-    HostP->Copy("RT_USED",PktReplyP->CommandText,7);
-  }
-  RIOQueueCmdBlk( HostP, Rup, CmdBlkP);
-  return TRUE;
+       RIOQueueCmdBlk(HostP, Rup, CmdBlkP);
+       return TRUE;
 }
 
 
-void
-RIOFixPhbs(p, HostP, unit)
+void RIOFixPhbs(p, HostP, unit)
 struct rio_info *p;
 struct Host *HostP;
 uint unit;
 {
-       ushort                  link, port;
-       struct Port             *PortP;
+       ushort link, port;
+       struct Port *PortP;
        unsigned long flags;
        int PortN = HostP->Mapping[unit].SysPort;
 
-       rio_dprintk (RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN);
+       rio_dprintk(RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN);
 
        if (PortN != -1) {
-               ushort          dest_unit = HostP->Mapping[unit].ID2;
+               ushort dest_unit = HostP->Mapping[unit].ID2;
 
                /*
-               ** Get the link number used for the 1st 8 phbs on this unit.
-               */
+                ** Get the link number used for the 1st 8 phbs on this unit.
+                */
                PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort];
 
                link = RWORD(PortP->PhbP->link);
 
                for (port = 0; port < PORTS_PER_RTA; port++, PortN++) {
-                       ushort          dest_port = port + 8;
+                       ushort dest_port = port + 8;
 #if 0
-                       uint            PktInt;
+                       uint PktInt;
 #endif
-                       WORD            *TxPktP;
-                       PKT             *Pkt;
+                       WORD *TxPktP;
+                       PKT *Pkt;
 
                        PortP = p->RIOPortp[PortN];
 
                        rio_spin_lock_irqsave(&PortP->portSem, flags);
                        /*
-                       ** If RTA is not powered on, the tx packets will be
-                       ** unset, so go no further.
-                       */
+                        ** If RTA is not powered on, the tx packets will be
+                        ** unset, so go no further.
+                        */
                        if (PortP->TxStart == 0) {
-                                       rio_dprintk (RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n");
-                                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                                       break;
+                               rio_dprintk(RIO_DEBUG_ROUTE, "Tx pkts not set up yet\n");
+                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                               break;
                        }
 
                        /*
-                       ** For the second slot of a 16 port RTA, the driver needs to
-                       ** sort out the phb to port mappings. The dest_unit for this
-                       ** group of 8 phbs is set to the dest_unit of the accompanying
-                       ** 8 port block. The dest_port of the second unit is set to
-                       ** be in the range 8-15 (i.e. 8 is added). Thus, for a 16 port
-                       ** RTA with IDs 5 and 6, traffic bound for port 6 of unit 6
-                       ** (being the second map ID) will be sent to dest_unit 5, port
-                       ** 14. When this RTA is deleted, dest_unit for ID 6 will be
-                       ** restored, and the dest_port will be reduced by 8.
-                       ** Transmit packets also have a destination field which needs
-                       ** adjusting in the same manner.
-                       ** Note that the unit/port bytes in 'dest' are swapped.
-                       ** We also need to adjust the phb and rup link numbers for the
-                       ** second block of 8 ttys.
-                       */
+                        ** For the second slot of a 16 port RTA, the driver needs to
+                        ** sort out the phb to port mappings. The dest_unit for this
+                        ** group of 8 phbs is set to the dest_unit of the accompanying
+                        ** 8 port block. The dest_port of the second unit is set to
+                        ** be in the range 8-15 (i.e. 8 is added). Thus, for a 16 port
+                        ** RTA with IDs 5 and 6, traffic bound for port 6 of unit 6
+                        ** (being the second map ID) will be sent to dest_unit 5, port
+                        ** 14. When this RTA is deleted, dest_unit for ID 6 will be
+                        ** restored, and the dest_port will be reduced by 8.
+                        ** Transmit packets also have a destination field which needs
+                        ** adjusting in the same manner.
+                        ** Note that the unit/port bytes in 'dest' are swapped.
+                        ** We also need to adjust the phb and rup link numbers for the
+                        ** second block of 8 ttys.
+                        */
                        for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) {
                                /*
-                               ** *TxPktP is the pointer to the transmit packet on the host
-                               ** card. This needs to be translated into a 32 bit pointer
-                               ** so it can be accessed from the driver.
-                               */
-                               Pkt = (PKT *) RIO_PTR(HostP->Caddr,RINDW(TxPktP));
+                                ** *TxPktP is the pointer to the transmit packet on the host
+                                ** card. This needs to be translated into a 32 bit pointer
+                                ** so it can be accessed from the driver.
+                                */
+                               Pkt = (PKT *) RIO_PTR(HostP->Caddr, RINDW(TxPktP));
 
                                /*
-                               ** If the packet is used, reset it.
-                               */
-                               Pkt = (PKT *)((uint)Pkt & ~PKT_IN_USE);
+                                ** If the packet is used, reset it.
+                                */
+                               Pkt = (PKT *) ((uint) Pkt & ~PKT_IN_USE);
                                WBYTE(Pkt->dest_unit, dest_unit);
                                WBYTE(Pkt->dest_port, dest_port);
                        }
-                       rio_dprintk (RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n",
-                                       RWORD(PortP->PhbP->destination) & 0xff,
-                                       (RWORD(PortP->PhbP->destination) >> 8) & 0xff,
-                                       dest_unit, dest_port);
+                       rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", RWORD(PortP->PhbP->destination) & 0xff, (RWORD(PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port);
                        WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8));
                        WWORD(PortP->PhbP->link, link);
 
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                }
                /*
-               ** Now make sure the range of ports to be serviced includes
-               ** the 2nd 8 on this 16 port RTA.
-               */
-               if (link > 3) return;
+                ** Now make sure the range of ports to be serviced includes
+                ** the 2nd 8 on this 16 port RTA.
+                */
+               if (link > 3)
+                       return;
                if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) {
-                       rio_dprintk (RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7);
+                       rio_dprintk(RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7);
                        WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7);
                }
        }
@@ -723,9 +615,8 @@ uint unit;
 ** the world about it. This is done to ensure that the configurator
 ** only gets up-to-date information about what is going on.
 */
-static int
-RIOCheckIsolated(p, HostP, UnitId)
-struct rio_info *      p;
+static int RIOCheckIsolated(p, HostP, UnitId)
+struct rio_info *p;
 struct Host *HostP;
 uint UnitId;
 {
@@ -733,16 +624,16 @@ uint UnitId;
        rio_spin_lock_irqsave(&HostP->HostLock, flags);
 
 #ifdef CHECK
-       CheckHostP( HostP );
-       CheckUnitId( UnitId );
+       CheckHostP(HostP);
+       CheckUnitId(UnitId);
 #endif
-       if ( RIOCheck( HostP, UnitId ) ) {
-               rio_dprintk (RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId);
+       if (RIOCheck(HostP, UnitId)) {
+               rio_dprintk(RIO_DEBUG_ROUTE, "Unit %d is NOT isolated\n", UnitId);
                rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
-               return(0);
+               return (0);
        }
 
-       RIOIsolate(p, HostP, UnitId );
+       RIOIsolate(p, HostP, UnitId);
        RIOSetChange(p);
        rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
        return 1;
@@ -753,85 +644,83 @@ uint UnitId;
 ** all the units attached to it. This will mean that the entire
 ** subnet will re-introduce itself.
 */
-static int
-RIOIsolate(p, HostP, UnitId)
-struct rio_info *      p;
-struct Host *          HostP;
-uint UnitId; 
+static int RIOIsolate(p, HostP, UnitId)
+struct rio_info *p;
+struct Host *HostP;
+uint UnitId;
 {
        uint link, unit;
 
 #ifdef CHECK
-       CheckHostP( HostP );
-       CheckUnitId( UnitId );
+       CheckHostP(HostP);
+       CheckUnitId(UnitId);
 #endif
        UnitId--;               /* this trick relies on the Unit Id being UNSIGNED! */
 
-       if ( UnitId >= MAX_RUP )        /* dontcha just lurv unsigned maths! */
-               return(0);
+       if (UnitId >= MAX_RUP)  /* dontcha just lurv unsigned maths! */
+               return (0);
 
-       if ( HostP->Mapping[UnitId].Flags & BEEN_HERE )
-               return(0);
+       if (HostP->Mapping[UnitId].Flags & BEEN_HERE)
+               return (0);
 
        HostP->Mapping[UnitId].Flags |= BEEN_HERE;
 
-       if ( p->RIOPrintDisabled == DO_PRINT )
-               rio_dprintk (RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name);
+       if (p->RIOPrintDisabled == DO_PRINT)
+               rio_dprintk(RIO_DEBUG_ROUTE, "RIOMesgIsolated %s", HostP->Mapping[UnitId].Name);
 
-       for ( link=0; link<LINKS_PER_UNIT; link++) {
+       for (link = 0; link < LINKS_PER_UNIT; link++) {
                unit = HostP->Mapping[UnitId].Topology[link].Unit;
                HostP->Mapping[UnitId].Topology[link].Unit = ROUTE_DISCONNECT;
                HostP->Mapping[UnitId].Topology[link].Link = NO_LINK;
-               RIOIsolate(p, HostP, unit );
+               RIOIsolate(p, HostP, unit);
        }
        HostP->Mapping[UnitId].Flags &= ~BEEN_HERE;
        return 1;
 }
 
-static int
-RIOCheck(HostP, UnitId)
+static int RIOCheck(HostP, UnitId)
 struct Host *HostP;
 uint UnitId;
 {
-  unsigned char link;
+       unsigned char link;
 
 #ifdef CHECK
-       CheckHostP( HostP );
-       CheckUnitId( UnitId );
+       CheckHostP(HostP);
+       CheckUnitId(UnitId);
 #endif
 /*     rio_dprint(RIO_DEBUG_ROUTE, ("Check to see if unit %d has a route to the host\n",UnitId)); */
-       rio_dprintk (RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId);
+       rio_dprintk(RIO_DEBUG_ROUTE, "RIOCheck : UnitID = %d\n", UnitId);
 
-       if ( UnitId == HOST_ID ) {
+       if (UnitId == HOST_ID) {
                /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is NOT isolated - it IS the host!\n", UnitId)); */
                return 1;
        }
 
        UnitId--;
 
-       if ( UnitId >= MAX_RUP ) {
+       if (UnitId >= MAX_RUP) {
                /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d - ignored.\n", UnitId)); */
                return 0;
        }
 
-       for ( link=0; link<LINKS_PER_UNIT; link++ ) {
-               if ( HostP->Mapping[UnitId].Topology[link].Unit==HOST_ID ) {
+       for (link = 0; link < LINKS_PER_UNIT; link++) {
+               if (HostP->Mapping[UnitId].Topology[link].Unit == HOST_ID) {
                        /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected directly to host via link (%c).\n", 
-                                               UnitId, 'A'+link)); */
+                          UnitId, 'A'+link)); */
                        return 1;
                }
        }
 
-       if ( HostP->Mapping[UnitId].Flags & BEEN_HERE ) {
+       if (HostP->Mapping[UnitId].Flags & BEEN_HERE) {
                /* rio_dprint(RIO_DEBUG_ROUTE, ("Been to Unit %d before - ignoring\n", UnitId)); */
                return 0;
        }
 
        HostP->Mapping[UnitId].Flags |= BEEN_HERE;
 
-       for ( link=0; link < LINKS_PER_UNIT; link++ ) {
+       for (link = 0; link < LINKS_PER_UNIT; link++) {
                /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d check link (%c)\n", UnitId,'A'+link)); */
-               if ( RIOCheck( HostP, HostP->Mapping[UnitId].Topology[link].Unit ) ) {
+               if (RIOCheck(HostP, HostP->Mapping[UnitId].Topology[link].Unit)) {
                        /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d is connected to something that knows the host via link (%c)\n", UnitId,link+'A')); */
                        HostP->Mapping[UnitId].Flags &= ~BEEN_HERE;
                        return 1;
@@ -841,7 +730,7 @@ uint UnitId;
        HostP->Mapping[UnitId].Flags &= ~BEEN_HERE;
 
        /* rio_dprint(RIO_DEBUG_ROUTE, ("Unit %d DOESNT KNOW THE HOST!\n", UnitId)); */
-       
+
        return 0;
 }
 
@@ -849,61 +738,57 @@ uint UnitId;
 ** Returns the type of unit (host, 16/8 port RTA)
 */
 
-uint
-GetUnitType(Uniq)
+uint GetUnitType(Uniq)
 uint Uniq;
 {
-       switch ( (Uniq >> 28) & 0xf)
-       {
-               case RIO_AT:
-               case RIO_MCA:
-               case RIO_EISA:
-               case RIO_PCI:
-                       rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Host\n");
-                       return(TYPE_HOST);
-               case RIO_RTA_16:
-                       rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n");
-                       return(TYPE_RTA16);
-               case RIO_RTA:
-                       rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n");
-                       return(TYPE_RTA8);
-               default :
-                       rio_dprintk (RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n");
-                       return(99);
+       switch ((Uniq >> 28) & 0xf) {
+       case RIO_AT:
+       case RIO_MCA:
+       case RIO_EISA:
+       case RIO_PCI:
+               rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Host\n");
+               return (TYPE_HOST);
+       case RIO_RTA_16:
+               rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 16 port RTA\n");
+               return (TYPE_RTA16);
+       case RIO_RTA:
+               rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: 8 port RTA\n");
+               return (TYPE_RTA8);
+       default:
+               rio_dprintk(RIO_DEBUG_ROUTE, "Unit type: Unrecognised\n");
+               return (99);
        }
 }
 
-int
-RIOSetChange(p)
-struct rio_info *      p;
+int RIOSetChange(p)
+struct rio_info *p;
 {
-       if ( p->RIOQuickCheck != NOT_CHANGED )
-               return(0);
+       if (p->RIOQuickCheck != NOT_CHANGED)
+               return (0);
        p->RIOQuickCheck = CHANGED;
-       if ( p->RIOSignalProcess ) {
-               rio_dprintk (RIO_DEBUG_ROUTE, "Send SIG-HUP");
+       if (p->RIOSignalProcess) {
+               rio_dprintk(RIO_DEBUG_ROUTE, "Send SIG-HUP");
                /*
-               psignal( RIOSignalProcess, SIGHUP );
-               */
+                  psignal( RIOSignalProcess, SIGHUP );
+                */
        }
-       return(0);
+       return (0);
 }
 
-static void
-RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change)
-struct rio_info *      p;
+static void RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change)
+struct rio_info *p;
 struct Host *HostP;
 uint FromId;
 uint FromLink;
 uint ToId;
 uint ToLink;
-int Change; 
+int Change;
 {
-    char *FromName;
-    char *FromType;
-    char *ToName;
-    char *ToType;
-    unsigned int tp;
+       char *FromName;
+       char *FromType;
+       char *ToName;
+       char *ToType;
+       unsigned int tp;
 
 /*
 ** 15.10.1998 ARG - ESIL 0759
@@ -932,38 +817,32 @@ int Change;
 ** rio_info struct - RIORtaDisCons (RIO RTA connections) keeps track of RTA
 ** connections and disconnections. 
 */
-    if (Change == CONNECT) {
-               if (p->RIORtaDisCons) p->RIORtaDisCons--;
-        }
-        else {
+       if (Change == CONNECT) {
+               if (p->RIORtaDisCons)
+                       p->RIORtaDisCons--;
+       } else {
                p->RIORtaDisCons++;
-        }
+       }
 
-    if ( p->RIOPrintDisabled == DONT_PRINT )
+       if (p->RIOPrintDisabled == DONT_PRINT)
                return;
 
-    if ( FromId > ToId ) {
+       if (FromId > ToId) {
                tp = FromId;
                FromId = ToId;
                ToId = tp;
                tp = FromLink;
                FromLink = ToLink;
                ToLink = tp;
-    }
-
-    FromName = FromId ? HostP->Mapping[FromId-1].Name : HostP->Name;
-    FromType = FromId ? "RTA" : "HOST";
-    ToName = ToId ? HostP->Mapping[ToId-1].Name : HostP->Name;
-    ToType = ToId ? "RTA" : "HOST";
-
-    rio_dprintk (RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n",
-                           FromType, FromName, 'A'+FromLink,
-                           ToType,   ToName,   'A'+ToLink,
-                           (Change==CONNECT) ? "established" : "disconnected");
-    cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n",
-                           FromType, FromName, 'A'+FromLink,
-                           ToType,   ToName,   'A'+ToLink,
-                           (Change==CONNECT) ? "established" : "disconnected");
+       }
+
+       FromName = FromId ? HostP->Mapping[FromId - 1].Name : HostP->Name;
+       FromType = FromId ? "RTA" : "HOST";
+       ToName = ToId ? HostP->Mapping[ToId - 1].Name : HostP->Name;
+       ToType = ToId ? "RTA" : "HOST";
+
+       rio_dprintk(RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected");
+       cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected");
 }
 
 /*
@@ -972,24 +851,21 @@ int Change;
 ** Delete and RTA entry from the saved table given to us
 ** by the configuration program.
 */
-static int
-RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
+static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
 {
-    int                entry;
-
-    /*
-    ** We loop for all entries even after finding an entry and
-    ** zeroing it because we may have two entries to delete if
-    ** it's a 16 port RTA.
-    */
-    for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++)
-    {
-       if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum)
-       {
-           bzero((caddr_t)&p->RIOSavedTable[entry], sizeof(struct Map));
+       int entry;
+
+       /*
+        ** We loop for all entries even after finding an entry and
+        ** zeroing it because we may have two entries to delete if
+        ** it's a 16 port RTA.
+        */
+       for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
+               if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) {
+                       bzero((caddr_t) & p->RIOSavedTable[entry], sizeof(struct Map));
+               }
        }
-    }
-    return 0;
+       return 0;
 }
 
 
@@ -999,64 +875,58 @@ RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
 ** Scan the unit links to and return zero if the unit is completely
 ** disconnected.
 */
-static int
-RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
+static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
 {
-    int                link;
-
-
-    rio_dprintk (RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit);
-    /*
-    ** If the slot is tentative and does not belong to the
-    ** second half of a 16 port RTA then scan to see if
-    ** is disconnected.
-    */
-    for (link = 0; link < LINKS_PER_UNIT; link++)
-    {
-       if (HostP->Mapping[unit].Topology[link].Unit != ROUTE_DISCONNECT)
-           break;
-    }
-
-    /*
-    ** If not all links are disconnected then we can forget about it.
-    */
-    if (link < LINKS_PER_UNIT)
-           return 1;
+       int link;
+
+
+       rio_dprintk(RIO_DEBUG_ROUTE, "RIOFreeDisconnect unit %d\n", unit);
+       /*
+        ** If the slot is tentative and does not belong to the
+        ** second half of a 16 port RTA then scan to see if
+        ** is disconnected.
+        */
+       for (link = 0; link < LINKS_PER_UNIT; link++) {
+               if (HostP->Mapping[unit].Topology[link].Unit != ROUTE_DISCONNECT)
+                       break;
+       }
+
+       /*
+        ** If not all links are disconnected then we can forget about it.
+        */
+       if (link < LINKS_PER_UNIT)
+               return 1;
 
 #ifdef NEED_TO_FIX_THIS
-    /* Ok so all the links are disconnected. But we may have only just
-    ** made this slot tentative and not yet received a topology update.
-    ** Lets check how long ago we made it tentative.
-    */
-    rio_dprintk (RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit);
-    if (drv_getparm(LBOLT, (ulong_t *) &current_time))
-        rio_dprintk (RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n");
-
-    elapse_time = current_time - TentTime[unit];
-    rio_dprintk (RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n",
-        elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time));
-    if (drv_hztousec(elapse_time) < WAIT_TO_FINISH)
-    {
-      rio_dprintk (RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n",
-            unit, drv_hztousec(elapse_time));
-        return 1;
-    }
+       /* Ok so all the links are disconnected. But we may have only just
+        ** made this slot tentative and not yet received a topology update.
+        ** Lets check how long ago we made it tentative.
+        */
+       rio_dprintk(RIO_DEBUG_ROUTE, "Just about to check LBOLT on entry %d\n", unit);
+       if (drv_getparm(LBOLT, (ulong_t *) & current_time))
+               rio_dprintk(RIO_DEBUG_ROUTE, "drv_getparm(LBOLT,....) Failed.\n");
+
+       elapse_time = current_time - TentTime[unit];
+       rio_dprintk(RIO_DEBUG_ROUTE, "elapse %d = current %d - tent %d (%d usec)\n", elapse_time, current_time, TentTime[unit], drv_hztousec(elapse_time));
+       if (drv_hztousec(elapse_time) < WAIT_TO_FINISH) {
+               rio_dprintk(RIO_DEBUG_ROUTE, "Skipping slot %d, not timed out yet %d\n", unit, drv_hztousec(elapse_time));
+               return 1;
+       }
 #endif
 
-    /*
-    ** We have found an usable slot.
-    ** If it is half of a 16 port RTA then delete the other half.
-    */
-    if (HostP->Mapping[unit].ID2 != 0)
-    {
-       int nOther = (HostP->Mapping[unit].ID2) -1;
-
-       rio_dprintk (RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther);
-       bzero((caddr_t)&HostP->Mapping[nOther], sizeof(struct Map));
-    }
-    RIORemoveFromSavedTable(p, &HostP->Mapping[unit]);
+       /*
+        ** We have found an usable slot.
+        ** If it is half of a 16 port RTA then delete the other half.
+        */
+       if (HostP->Mapping[unit].ID2 != 0) {
+               int nOther = (HostP->Mapping[unit].ID2) - 1;
+
+               rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther);
+               bzero((caddr_t) & HostP->Mapping[nOther], sizeof(struct Map));
+       }
+       RIORemoveFromSavedTable(p, &HostP->Mapping[unit]);
 
-    return 0;
+       return 0;
 }
 
 
@@ -1066,150 +936,134 @@ RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit)
 ** This function scans the given host table for either one
 ** or two free unit ID's.
 */
-int
-RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint *pID1, uint *pID2)
+int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pID2)
 {
-    int unit,tempID;
-
-    /*
-    ** Initialise the ID's to MAX_RUP.
-    ** We do this to make the loop for setting the ID's as simple as
-    ** possible.
-    */
-    *pID1 = MAX_RUP;
-    if (pID2 != NULL)
-       *pID2 = MAX_RUP;
-
-    /*
-    ** Scan all entries of the host mapping table for free slots.
-    ** We scan for free slots first and then if that is not successful
-    ** we start all over again looking for tentative slots we can re-use.
-    */
-    for (unit = 0; unit < MAX_RUP; unit++)
-    {
-       rio_dprintk (RIO_DEBUG_ROUTE, "Scanning unit %d\n",unit);
+       int unit, tempID;
+
        /*
-       ** If the flags are zero then the slot is empty.
-       */
-       if (HostP->Mapping[unit].Flags == 0)
-       {
-           rio_dprintk (RIO_DEBUG_ROUTE, "      This slot is empty.\n");
-           /*
-           ** If we haven't allocated the first ID then do it now.
-           */
-           if (*pID1 == MAX_RUP)
-           {
-               rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit);
-               *pID1 = unit;
+        ** Initialise the ID's to MAX_RUP.
+        ** We do this to make the loop for setting the ID's as simple as
+        ** possible.
+        */
+       *pID1 = MAX_RUP;
+       if (pID2 != NULL)
+               *pID2 = MAX_RUP;
 
+       /*
+        ** Scan all entries of the host mapping table for free slots.
+        ** We scan for free slots first and then if that is not successful
+        ** we start all over again looking for tentative slots we can re-use.
+        */
+       for (unit = 0; unit < MAX_RUP; unit++) {
+               rio_dprintk(RIO_DEBUG_ROUTE, "Scanning unit %d\n", unit);
                /*
-               ** If the second ID is not needed then we can return
-               ** now.
-               */
-               if (pID2 == NULL)
-                   return 0;
-           }
-           else
-           {
-               /*
-               ** Allocate the second slot and return.
-               */
-               rio_dprintk (RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit);
-               *pID2 = unit;
-               return 0;
-           }
+                ** If the flags are zero then the slot is empty.
+                */
+               if (HostP->Mapping[unit].Flags == 0) {
+                       rio_dprintk(RIO_DEBUG_ROUTE, "      This slot is empty.\n");
+                       /*
+                        ** If we haven't allocated the first ID then do it now.
+                        */
+                       if (*pID1 == MAX_RUP) {
+                               rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for first unit %d\n", unit);
+                               *pID1 = unit;
+
+                               /*
+                                ** If the second ID is not needed then we can return
+                                ** now.
+                                */
+                               if (pID2 == NULL)
+                                       return 0;
+                       } else {
+                               /*
+                                ** Allocate the second slot and return.
+                                */
+                               rio_dprintk(RIO_DEBUG_ROUTE, "Make tentative entry for second unit %d\n", unit);
+                               *pID2 = unit;
+                               return 0;
+                       }
+               }
        }
-    }
-
-    /*
-    ** If we manage to come out of the free slot loop then we
-    ** need to start all over again looking for tentative slots
-    ** that we can re-use.
-    */
-    rio_dprintk (RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n");
-    for (unit = 0; unit < MAX_RUP; unit++)
-    {
-       if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) ||
-                              (HostP->Mapping[unit].Flags == 0))  && ! 
-          (HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT ))
-       {
-           rio_dprintk (RIO_DEBUG_ROUTE, "    Slot %d looks promising.\n",unit);
-
-           if(unit == *pID1)
-           {
-               rio_dprintk (RIO_DEBUG_ROUTE, "    No it isn't, its the 1st half\n");
-               continue;
-           }
-
-           /*
-           ** Slot is Tentative or Empty, but not a tentative second 
-           ** slot of a 16 porter.
-           ** Attempt to free up this slot (and its parnter if
-           ** it is a 16 port slot. The second slot will become
-           ** empty after a call to RIOFreeDisconnected so thats why
-           ** we look for empty slots above  as well).
-           */
-           if (HostP->Mapping[unit].Flags != 0) 
-               if (RIOFreeDisconnected(p, HostP, unit) != 0)
-                           continue;
-           /*
-           ** If we haven't allocated the first ID then do it now.
-           */
-           if (*pID1 == MAX_RUP)
-           {
-               rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit);
-               *pID1 = unit;
 
-               /*
-               ** Clear out this slot now that we intend to use it.
-               */
-               bzero(&HostP->Mapping[unit], sizeof(struct Map));
+       /*
+        ** If we manage to come out of the free slot loop then we
+        ** need to start all over again looking for tentative slots
+        ** that we can re-use.
+        */
+       rio_dprintk(RIO_DEBUG_ROUTE, "Starting to scan for tentative slots\n");
+       for (unit = 0; unit < MAX_RUP; unit++) {
+               if (((HostP->Mapping[unit].Flags & SLOT_TENTATIVE) || (HostP->Mapping[unit].Flags == 0)) && !(HostP->Mapping[unit].Flags & RTA16_SECOND_SLOT)) {
+                       rio_dprintk(RIO_DEBUG_ROUTE, "    Slot %d looks promising.\n", unit);
+
+                       if (unit == *pID1) {
+                               rio_dprintk(RIO_DEBUG_ROUTE, "    No it isn't, its the 1st half\n");
+                               continue;
+                       }
 
-               /*
-               ** If the second ID is not needed then we can return
-               ** now.
-               */
-               if (pID2 == NULL)
-                   return 0;
-           }
-           else
-           {
-               /*
-               ** Allocate the second slot and return.
-               */
-               rio_dprintk (RIO_DEBUG_ROUTE, "Grab tentative/empty  entry for second unit %d\n",
-                     unit);
-               *pID2 = unit;
+                       /*
+                        ** Slot is Tentative or Empty, but not a tentative second
+                        ** slot of a 16 porter.
+                        ** Attempt to free up this slot (and its parnter if
+                        ** it is a 16 port slot. The second slot will become
+                        ** empty after a call to RIOFreeDisconnected so thats why
+                        ** we look for empty slots above  as well).
+                        */
+                       if (HostP->Mapping[unit].Flags != 0)
+                               if (RIOFreeDisconnected(p, HostP, unit) != 0)
+                                       continue;
+                       /*
+                        ** If we haven't allocated the first ID then do it now.
+                        */
+                       if (*pID1 == MAX_RUP) {
+                               rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative entry for first unit %d\n", unit);
+                               *pID1 = unit;
 
-               /*
-               ** Clear out this slot now that we intend to use it.
-               */
-               bzero(&HostP->Mapping[unit], sizeof(struct Map));
-
-               /* At this point under the right(wrong?) conditions
-               ** we may have a first unit ID being higher than the
-               ** second unit ID. This is a bad idea if we are about
-               ** to fill the slots with a 16 port RTA.
-               ** Better check and swap them over.
-               */
-
-               if (*pID1 > *pID2)
-               {
-                       rio_dprintk (RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2);
-                       tempID = *pID1;
-                       *pID1 = *pID2;
-                       *pID2 = tempID;
+                               /*
+                                ** Clear out this slot now that we intend to use it.
+                                */
+                               bzero(&HostP->Mapping[unit], sizeof(struct Map));
+
+                               /*
+                                ** If the second ID is not needed then we can return
+                                ** now.
+                                */
+                               if (pID2 == NULL)
+                                       return 0;
+                       } else {
+                               /*
+                                ** Allocate the second slot and return.
+                                */
+                               rio_dprintk(RIO_DEBUG_ROUTE, "Grab tentative/empty  entry for second unit %d\n", unit);
+                               *pID2 = unit;
+
+                               /*
+                                ** Clear out this slot now that we intend to use it.
+                                */
+                               bzero(&HostP->Mapping[unit], sizeof(struct Map));
+
+                               /* At this point under the right(wrong?) conditions
+                                ** we may have a first unit ID being higher than the
+                                ** second unit ID. This is a bad idea if we are about
+                                ** to fill the slots with a 16 port RTA.
+                                ** Better check and swap them over.
+                                */
+
+                               if (*pID1 > *pID2) {
+                                       rio_dprintk(RIO_DEBUG_ROUTE, "Swapping IDS %d %d\n", *pID1, *pID2);
+                                       tempID = *pID1;
+                                       *pID1 = *pID2;
+                                       *pID2 = tempID;
+                               }
+                               return 0;
+                       }
                }
-               return 0;
-           }
        }
-    }
 
-    /*
-    ** If we manage to get to the end of the second loop then we
-    ** can give up and return a failure.
-    */
-    return 1;
+       /*
+        ** If we manage to get to the end of the second loop then we
+        ** can give up and return a failure.
+        */
+       return 1;
 }
 
 
index 32b09b0f23aa0556049c13dd4deae4d2928cbf5e..534f1f5b9f53a16b714b8b061ed3ce00b982a9a6 100644 (file)
@@ -47,9 +47,8 @@ static char *_riospace_h_sccs_ = "@(#)riospace.h      1.2";
 ** In particular, it won't be able to see changes to RIO_SLOTS
 */
 
-struct Conf
-{
-       char         Locator[24];
+struct Conf {
+       char Locator[24];
        unsigned int StartupTime;
        unsigned int SlowCook;
        unsigned int IntrPollTime;
@@ -59,8 +58,8 @@ struct Conf
        unsigned int HostLoadBase;
        unsigned int XpHz;
        unsigned int XpCps;
-       char         *XpOn;
-       char         *XpOff;
+       char *XpOn;
+       char *XpOff;
        unsigned int MaxXpCps;
        unsigned int MinXpCps;
        unsigned int SpinCmds;
@@ -74,7 +73,7 @@ struct Conf
 
 /*
 **     Board types - these MUST correspond to product codes!
-*/ 
+*/
 #define        RIO_EMPTY       0x0
 #define        RIO_EISA        0x3
 #define        RIO_RTA_16      0x9
@@ -86,18 +85,16 @@ struct Conf
 /*
 **     Board data structure. This is used for configuration info
 */
-struct Brd
-{
-    unsigned char Type;        /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */
-    unsigned char Ivec;        /* POLLED or ivec number */
-    unsigned char Mode;        /* Control stuff, see below */
+struct Brd {
+       unsigned char Type;     /* RIO_EISA, RIO_MCA, RIO_AT, RIO_EMPTY... */
+       unsigned char Ivec;     /* POLLED or ivec number */
+       unsigned char Mode;     /* Control stuff, see below */
 };
 
-struct Board
-{
-    char       Locator[RIO_LOCATOR_LEN];
-    int        NumSlots;
-    struct Brd Boards[MAX_RIO_BOARDS];
+struct Board {
+       char Locator[RIO_LOCATOR_LEN];
+       int NumSlots;
+       struct Brd Boards[MAX_RIO_BOARDS];
 };
 
 #define        BOOT_FROM_LINK          0x00
@@ -158,4 +155,4 @@ struct      Board
 
 #define        DBG_ALWAYS      0x80000000
 
-#endif /* __rio_riospace_h__ */
+#endif                         /* __rio_riospace_h__ */
index e45bc275907a0725e95700812d92c445c93d992f..42c3dffcbbb2c49b96ebce8f669518102a7614c5 100644 (file)
@@ -91,9 +91,8 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c      1.2";
 ** A configuration table has been loaded. It is now up to us
 ** to sort it out and use the information contained therein.
 */
-int
-RIONewTable(p)
-struct rio_info *      p;
+int RIONewTable(p)
+struct rio_info *p;
 {
        int Host, Host1, Host2, NameIsUnique, Entry, SubEnt;
        struct Map *MapP;
@@ -103,26 +102,26 @@ struct rio_info * p;
        char *cptr;
 
        /*
-       ** We have been sent a new table to install. We need to break
-       ** it down into little bits and spread it around a bit to see
-       ** what we have got.
-       */
+        ** We have been sent a new table to install. We need to break
+        ** it down into little bits and spread it around a bit to see
+        ** what we have got.
+        */
        /*
-       ** Things to check:
-       ** (things marked 'xx' aren't checked any more!)
-       ** (1)  That there are no booted Hosts/RTAs out there.
-       ** (2)  That the names are properly formed
-       ** (3)  That blank entries really are.
-       ** xx (4)       That hosts mentioned in the table actually exist. xx
-       ** (5)  That the IDs are unique (per host).
-       ** (6)  That host IDs are zero
-       ** (7)  That port numbers are valid
-       ** (8)  That port numbers aren't duplicated
-       ** (9)  That names aren't duplicated
-       ** xx (10) That hosts that actually exist are mentioned in the table. xx
-       */
-       rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n"); 
-       if ( p->RIOSystemUp ) {         /* (1) */
+        ** Things to check:
+        ** (things marked 'xx' aren't checked any more!)
+        ** (1) That there are no booted Hosts/RTAs out there.
+        ** (2) That the names are properly formed
+        ** (3) That blank entries really are.
+        ** xx (4)      That hosts mentioned in the table actually exist. xx
+        ** (5) That the IDs are unique (per host).
+        ** (6) That host IDs are zero
+        ** (7) That port numbers are valid
+        ** (8) That port numbers aren't duplicated
+        ** (9) That names aren't duplicated
+        ** xx (10) That hosts that actually exist are mentioned in the table. xx
+        */
+       rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n");
+       if (p->RIOSystemUp) {   /* (1) */
                p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED;
                return -EBUSY;
        }
@@ -131,19 +130,19 @@ struct rio_info * p;
        p->RIOError.Entry = -1;
        p->RIOError.Other = -1;
 
-       for ( Entry=0; Entry<TOTAL_MAP_ENTRIES; Entry++ ) {
+       for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
                MapP = &p->RIOConnectTable[Entry];
                if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) {
-                       rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n");
-                       cptr = MapP->Name;              /* (2) */
-                       cptr[MAX_NAME_LEN-1]='\0';
-                       if ( cptr[0]=='\0' ) {
-                               bcopy(MapP->RtaUniqueNum?"RTA   NN":"HOST NN",MapP->Name,8);
-                               MapP->Name[5] = '0'+Entry/10;
-                               MapP->Name[6] = '0'+Entry%10;
+                       rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n");
+                       cptr = MapP->Name;      /* (2) */
+                       cptr[MAX_NAME_LEN - 1] = '\0';
+                       if (cptr[0] == '\0') {
+                               bcopy(MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", MapP->Name, 8);
+                               MapP->Name[5] = '0' + Entry / 10;
+                               MapP->Name[6] = '0' + Entry % 10;
                        }
-                       while ( *cptr ) {
-                               if ( *cptr<' ' || *cptr>'~' ) {
+                       while (*cptr) {
+                               if (*cptr < ' ' || *cptr > '~') {
                                        p->RIOError.Error = BAD_CHARACTER_IN_NAME;
                                        p->RIOError.Entry = Entry;
                                        return -ENXIO;
@@ -153,133 +152,119 @@ struct rio_info *       p;
                }
 
                /*
-               ** If the entry saved was a tentative entry then just forget
-               ** about it.
-               */
-               if ( MapP->Flags & SLOT_TENTATIVE ) {
+                ** If the entry saved was a tentative entry then just forget
+                ** about it.
+                */
+               if (MapP->Flags & SLOT_TENTATIVE) {
                        MapP->HostUniqueNum = 0;
                        MapP->RtaUniqueNum = 0;
                        continue;
                }
 
-               rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n");
-               if ( !MapP->RtaUniqueNum && !MapP->HostUniqueNum ) { /* (3) */
-                       if ( MapP->ID || MapP->SysPort || MapP->Flags ) {
-                               rio_dprintk (RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n",MapP->Name);
+               rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n");
+               if (!MapP->RtaUniqueNum && !MapP->HostUniqueNum) {      /* (3) */
+                       if (MapP->ID || MapP->SysPort || MapP->Flags) {
+                               rio_dprintk(RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n", MapP->Name);
                                p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL;
                                p->RIOError.Entry = Entry;
                                return -ENXIO;
                        }
-                       rio_dprintk (RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n");
+                       rio_dprintk(RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n");
                        continue;
                }
 
-               rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n");
-               for ( Host=0; Host<p->RIONumHosts; Host++ ) { /* (4) */
-                       if ( p->RIOHosts[Host].UniqueNum==MapP->HostUniqueNum ) {
+               rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n");
+               for (Host = 0; Host < p->RIONumHosts; Host++) { /* (4) */
+                       if (p->RIOHosts[Host].UniqueNum == MapP->HostUniqueNum) {
                                HostP = &p->RIOHosts[Host];
                                /*
-                               ** having done the lookup, we don't really want to do
-                               ** it again, so hang the host number in a safe place
-                               */
+                                ** having done the lookup, we don't really want to do
+                                ** it again, so hang the host number in a safe place
+                                */
                                MapP->Topology[0].Unit = Host;
                                break;
                        }
                }
 
-               if ( Host >= p->RIONumHosts ) {
-                       rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n",
-                                                                       MapP->Name, MapP->HostUniqueNum);
+               if (Host >= p->RIONumHosts) {
+                       rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", MapP->Name, MapP->HostUniqueNum);
                        MapP->HostUniqueNum = 0;
-                       /* MapP->RtaUniqueNum   = 0; */
-                       /* MapP->ID                     = 0; */
-                       /* MapP->Flags           = 0; */
-                       /* MapP->SysPort                 = 0; */
-                       /* MapP->Name[0]                 = 0; */
+                       /* MapP->RtaUniqueNum   = 0; */
+                       /* MapP->ID                     = 0; */
+                       /* MapP->Flags           = 0; */
+                       /* MapP->SysPort                 = 0; */
+                       /* MapP->Name[0]                 = 0; */
                        continue;
                }
 
-               rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n"); 
-               if ( MapP->RtaUniqueNum ) { /* (5) */
-                       if ( !MapP->ID ) {
-                               rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n",
-                                                       MapP->Name);
-                               p->RIOError.Error                = ZERO_RTA_ID;
+               rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(5)\n");
+               if (MapP->RtaUniqueNum) {       /* (5) */
+                       if (!MapP->ID) {
+                               rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an ID of zero!\n", MapP->Name);
+                               p->RIOError.Error = ZERO_RTA_ID;
                                p->RIOError.Entry = Entry;
                                return -ENXIO;
                        }
-                       if ( MapP->ID > MAX_RUP ) {
-                               rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n",
-                                                       MapP->Name, MapP->ID);
+                       if (MapP->ID > MAX_RUP) {
+                               rio_dprintk(RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an invalid ID %d\n", MapP->Name, MapP->ID);
                                p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
                                p->RIOError.Entry = Entry;
                                return -ENXIO;
                        }
-                       for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) {
-                               if ( MapP->HostUniqueNum == 
-                                               p->RIOConnectTable[SubEnt].HostUniqueNum && 
-                                               MapP->ID == p->RIOConnectTable[SubEnt].ID ) {
-                                       rio_dprintk (RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n",
-                                                       MapP->Name, p->RIOConnectTable[SubEnt].Name);
+                       for (SubEnt = 0; SubEnt < Entry; SubEnt++) {
+                               if (MapP->HostUniqueNum == p->RIOConnectTable[SubEnt].HostUniqueNum && MapP->ID == p->RIOConnectTable[SubEnt].ID) {
+                                       rio_dprintk(RIO_DEBUG_TABLE, "Dupl. ID number allocated to RTA %s and RTA %s\n", MapP->Name, p->RIOConnectTable[SubEnt].Name);
                                        p->RIOError.Error = DUPLICATED_RTA_ID;
                                        p->RIOError.Entry = Entry;
                                        p->RIOError.Other = SubEnt;
                                        return -ENXIO;
                                }
                                /*
-                               ** If the RtaUniqueNum is the same, it may be looking at both
-                               ** entries for a 16 port RTA, so check the ids
-                               */
-                               if ((MapP->RtaUniqueNum == 
-                                               p->RIOConnectTable[SubEnt].RtaUniqueNum)
-                                               && (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) {
-                                       rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n",MapP->Name);
-                                       rio_dprintk (RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n",
-                                                                               p->RIOConnectTable[SubEnt].Name);
+                                ** If the RtaUniqueNum is the same, it may be looking at both
+                                ** entries for a 16 port RTA, so check the ids
+                                */
+                               if ((MapP->RtaUniqueNum == p->RIOConnectTable[SubEnt].RtaUniqueNum)
+                                   && (MapP->ID2 != p->RIOConnectTable[SubEnt].ID)) {
+                                       rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", MapP->Name);
+                                       rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has duplicate unique number\n", p->RIOConnectTable[SubEnt].Name);
                                        p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER;
                                        p->RIOError.Entry = Entry;
                                        p->RIOError.Other = SubEnt;
                                        return -ENXIO;
                                }
                        }
-                       rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n"); 
+                       rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n");
                        /* (7a) */
-                       if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort % PORTS_PER_RTA)) {
-                               rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d-RTA %s is not a multiple of %d!\n",
-                                       (int)MapP->SysPort,MapP->Name, PORTS_PER_RTA);
+                       if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) {
+                               rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d-RTA %s is not a multiple of %d!\n", (int) MapP->SysPort, MapP->Name, PORTS_PER_RTA);
                                p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
                                p->RIOError.Entry = Entry;
                                return -ENXIO;
                        }
-                       rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n"); 
+                       rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n");
                        /* (7b) */
-                       if ((MapP->SysPort != NO_PORT)&&(MapP->SysPort >= RIO_PORTS)) {
-                               rio_dprintk (RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n",
-                                                       (int)MapP->SysPort, MapP->Name);
+                       if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) {
+                               rio_dprintk(RIO_DEBUG_TABLE, "TTY Port number %d for RTA %s is too big\n", (int) MapP->SysPort, MapP->Name);
                                p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
                                p->RIOError.Entry = Entry;
                                return -ENXIO;
                        }
-                       for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) {
-                               if ( p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT )
-                                               continue;
-                               if ( p->RIOConnectTable[SubEnt].RtaUniqueNum ) {
-                                       rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n"); 
+                       for (SubEnt = 0; SubEnt < Entry; SubEnt++) {
+                               if (p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT)
+                                       continue;
+                               if (p->RIOConnectTable[SubEnt].RtaUniqueNum) {
+                                       rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(8)\n");
                                        /* (8) */
-                                       if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort == 
-                                                                       p->RIOConnectTable[SubEnt].SysPort) ) {
-                                               rio_dprintk (RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n",
-                                                       MapP->Name, p->RIOConnectTable[SubEnt].Name,
-                                                       (int)MapP->SysPort);
+                                       if ((MapP->SysPort != NO_PORT) && (MapP->SysPort == p->RIOConnectTable[SubEnt].SysPort)) {
+                                               rio_dprintk(RIO_DEBUG_TABLE, "RTA %s:same TTY port # as RTA %s (%d)\n", MapP->Name, p->RIOConnectTable[SubEnt].Name, (int) MapP->SysPort);
                                                p->RIOError.Error = TTY_NUMBER_IN_USE;
                                                p->RIOError.Entry = Entry;
                                                p->RIOError.Other = SubEnt;
                                                return -ENXIO;
                                        }
-                                       rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n"); 
-                                       if (strcmp(MapP->Name,
-                                                       p->RIOConnectTable[SubEnt].Name)==0 && !(MapP->Flags & RTA16_SECOND_SLOT)) { /* (9) */
-                                               rio_dprintk (RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name);
+                                       rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n");
+                                       if (strcmp(MapP->Name, p->RIOConnectTable[SubEnt].Name) == 0 && !(MapP->Flags & RTA16_SECOND_SLOT)) {   /* (9) */
+                                               rio_dprintk(RIO_DEBUG_TABLE, "RTA name %s used twice\n", MapP->Name);
                                                p->RIOError.Error = NAME_USED_TWICE;
                                                p->RIOError.Entry = Entry;
                                                p->RIOError.Other = SubEnt;
@@ -287,19 +272,16 @@ struct rio_info * p;
                                        }
                                }
                        }
-               }
-               else { /* (6) */
-                       rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n"); 
-                       if ( MapP->ID ) {
-                               rio_dprintk (RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n",
-                                       MapP->Name);
+               } else {        /* (6) */
+                       rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(6)\n");
+                       if (MapP->ID) {
+                               rio_dprintk(RIO_DEBUG_TABLE, "RIO:HOST %s has been allocated ID that isn't zero!\n", MapP->Name);
                                p->RIOError.Error = HOST_ID_NOT_ZERO;
                                p->RIOError.Entry = Entry;
                                return -ENXIO;
                        }
-                       if ( MapP->SysPort != NO_PORT ) {
-                               rio_dprintk (RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n",
-                                       MapP->Name);
+                       if (MapP->SysPort != NO_PORT) {
+                               rio_dprintk(RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", MapP->Name);
                                p->RIOError.Error = HOST_SYSPORT_BAD;
                                p->RIOError.Entry = Entry;
                                return -ENXIO;
@@ -308,106 +290,101 @@ struct rio_info *       p;
        }
 
        /*
-       ** wow! if we get here then it's a goody!
-       */
+        ** wow! if we get here then it's a goody!
+        */
 
        /*
-       ** Zero the (old) entries for each host...
-       */
-       for ( Host=0; Host<RIO_HOSTS; Host++ ) {
-               for ( Entry=0; Entry<MAX_RUP; Entry++ ) {
-                       bzero((caddr_t)&p->RIOHosts[Host].Mapping[Entry], 
-                                                                                       sizeof(struct Map));
+        ** Zero the (old) entries for each host...
+        */
+       for (Host = 0; Host < RIO_HOSTS; Host++) {
+               for (Entry = 0; Entry < MAX_RUP; Entry++) {
+                       bzero((caddr_t) & p->RIOHosts[Host].Mapping[Entry], sizeof(struct Map));
                }
-               bzero((caddr_t)&p->RIOHosts[Host].Name[0],
-                                                               sizeof(p->RIOHosts[Host].Name) );
+               bzero((caddr_t) & p->RIOHosts[Host].Name[0], sizeof(p->RIOHosts[Host].Name));
        }
 
        /*
-       ** Copy in the new table entries
-       */
-       for ( Entry=0; Entry< TOTAL_MAP_ENTRIES; Entry++ ) {
-               rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry);
+        ** Copy in the new table entries
+        */
+       for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
+               rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: Copy table for Host entry %d\n", Entry);
                MapP = &p->RIOConnectTable[Entry];
 
                /*
-               ** Now, if it is an empty slot ignore it!
-               */
-               if ( MapP->HostUniqueNum==0 )
+                ** Now, if it is an empty slot ignore it!
+                */
+               if (MapP->HostUniqueNum == 0)
                        continue;
 
                /*
-               ** we saved the host number earlier, so grab it back
-               */
+                ** we saved the host number earlier, so grab it back
+                */
                HostP = &p->RIOHosts[MapP->Topology[0].Unit];
 
                /*
-               ** If it is a host, then we only need to fill in the name field.
-               */
-               if ( MapP->ID==0 ) {
-                       rio_dprintk (RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name);
-                       bcopy(MapP->Name,HostP->Name,MAX_NAME_LEN);
+                ** If it is a host, then we only need to fill in the name field.
+                */
+               if (MapP->ID == 0) {
+                       rio_dprintk(RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name);
+                       bcopy(MapP->Name, HostP->Name, MAX_NAME_LEN);
                        continue;
                }
 
                /*
-               ** Its an RTA entry, so fill in the host mapping entries for it
-               ** and the port mapping entries. Notice that entry zero is for
-               ** ID one.
-               */
-               HostMapP = &HostP->Mapping[MapP->ID-1];
+                ** Its an RTA entry, so fill in the host mapping entries for it
+                ** and the port mapping entries. Notice that entry zero is for
+                ** ID one.
+                */
+               HostMapP = &HostP->Mapping[MapP->ID - 1];
 
                if (MapP->Flags & SLOT_IN_USE) {
-                       rio_dprintk (RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name);
+                       rio_dprintk(RIO_DEBUG_TABLE, "Rta entry found. Name %s\n", MapP->Name);
                        /*
-                       ** structure assign, then sort out the bits we shouldn't have done
-                       */
+                        ** structure assign, then sort out the bits we shouldn't have done
+                        */
                        *HostMapP = *MapP;
 
                        HostMapP->Flags = SLOT_IN_USE;
                        if (MapP->Flags & RTA16_SECOND_SLOT)
                                HostMapP->Flags |= RTA16_SECOND_SLOT;
 
-                       RIOReMapPorts(p, HostP, HostMapP );
-               }
-               else {
-                       rio_dprintk (RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name);
+                       RIOReMapPorts(p, HostP, HostMapP);
+               } else {
+                       rio_dprintk(RIO_DEBUG_TABLE, "TENTATIVE Rta entry found. Name %s\n", MapP->Name);
                }
        }
 
-       for ( Entry=0; Entry< TOTAL_MAP_ENTRIES; Entry++ ) {
+       for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
                p->RIOSavedTable[Entry] = p->RIOConnectTable[Entry];
        }
 
-       for ( Host=0; Host<p->RIONumHosts; Host++ ) {
-               for ( SubEnt=0; SubEnt<LINKS_PER_UNIT; SubEnt++ ) {
+       for (Host = 0; Host < p->RIONumHosts; Host++) {
+               for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) {
                        p->RIOHosts[Host].Topology[SubEnt].Unit = ROUTE_DISCONNECT;
                        p->RIOHosts[Host].Topology[SubEnt].Link = NO_LINK;
                }
-               for ( Entry=0; Entry<MAX_RUP; Entry++ ) {
-                       for ( SubEnt=0; SubEnt<LINKS_PER_UNIT; SubEnt++ ) {
-                               p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = 
-                                                               ROUTE_DISCONNECT;
-                               p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = 
-                                                               NO_LINK;
+               for (Entry = 0; Entry < MAX_RUP; Entry++) {
+                       for (SubEnt = 0; SubEnt < LINKS_PER_UNIT; SubEnt++) {
+                               p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Unit = ROUTE_DISCONNECT;
+                               p->RIOHosts[Host].Mapping[Entry].Topology[SubEnt].Link = NO_LINK;
                        }
                }
-               if ( !p->RIOHosts[Host].Name[0] ) {
-                       bcopy("HOST 1",p->RIOHosts[Host].Name,7);
+               if (!p->RIOHosts[Host].Name[0]) {
+                       bcopy("HOST 1", p->RIOHosts[Host].Name, 7);
                        p->RIOHosts[Host].Name[5] += Host;
                }
                /*
-               ** Check that default name assigned is unique.
-               */
+                ** Check that default name assigned is unique.
+                */
                Host1 = Host;
                NameIsUnique = 0;
                while (!NameIsUnique) {
                        NameIsUnique = 1;
-                       for ( Host2=0; Host2<p->RIONumHosts; Host2++ ) {
+                       for (Host2 = 0; Host2 < p->RIONumHosts; Host2++) {
                                if (Host2 == Host)
                                        continue;
                                if (strcmp(p->RIOHosts[Host].Name, p->RIOHosts[Host2].Name)
-                                                                        == 0) {
+                                   == 0) {
                                        NameIsUnique = 0;
                                        Host1++;
                                        if (Host1 >= p->RIONumHosts)
@@ -417,15 +394,14 @@ struct rio_info * p;
                        }
                }
                /*
-               ** Rename host if name already used.
-               */
-               if (Host1 != Host)
-               {
-                       rio_dprintk (RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name);
-                       bcopy("HOST 1",p->RIOHosts[Host].Name,7);
+                ** Rename host if name already used.
+                */
+               if (Host1 != Host) {
+                       rio_dprintk(RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name);
+                       bcopy("HOST 1", p->RIOHosts[Host].Name, 7);
                        p->RIOHosts[Host].Name[5] += Host1;
                }
-               rio_dprintk (RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name);
+               rio_dprintk(RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name);
        }
        return 0;
 }
@@ -434,9 +410,8 @@ struct rio_info *   p;
 ** User process needs the config table - build it from first
 ** principles.
 */
-int
-RIOApel(p)
-struct rio_info *      p;
+int RIOApel(p)
+struct rio_info *p;
 {
        int Host;
        int link;
@@ -446,35 +421,34 @@ struct rio_info * p;
        struct Host *HostP;
        long oldspl;
 
-       disable(oldspl);                /* strange but true! */
-       rio_dprintk (RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n");
+       disable(oldspl);        /* strange but true! */
+
+       rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n");
 
-       bzero((caddr_t)&p->RIOConnectTable[0], 
-                                       sizeof(struct Map) * TOTAL_MAP_ENTRIES );
+       bzero((caddr_t) & p->RIOConnectTable[0], sizeof(struct Map) * TOTAL_MAP_ENTRIES);
 
-       for ( Host=0; Host<RIO_HOSTS; Host++ ) {
-               rio_dprintk (RIO_DEBUG_TABLE, "Processing host %d\n", Host);
+       for (Host = 0; Host < RIO_HOSTS; Host++) {
+               rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host);
                HostP = &p->RIOHosts[Host];
                MapP = &p->RIOConnectTable[Next++];
                MapP->HostUniqueNum = HostP->UniqueNum;
-               if ( (HostP->Flags & RUN_STATE) != RC_RUNNING )
+               if ((HostP->Flags & RUN_STATE) != RC_RUNNING)
                        continue;
                MapP->RtaUniqueNum = 0;
                MapP->ID = 0;
                MapP->Flags = SLOT_IN_USE;
                MapP->SysPort = NO_PORT;
-               for ( link=0; link<LINKS_PER_UNIT; link++ )
+               for (link = 0; link < LINKS_PER_UNIT; link++)
                        MapP->Topology[link] = HostP->Topology[link];
-               bcopy(HostP->Name,MapP->Name,MAX_NAME_LEN);
-               for ( Rup=0; Rup<MAX_RUP; Rup++ ) {
-                       if ( HostP->Mapping[Rup].Flags & (SLOT_IN_USE|SLOT_TENTATIVE) ) {
+               bcopy(HostP->Name, MapP->Name, MAX_NAME_LEN);
+               for (Rup = 0; Rup < MAX_RUP; Rup++) {
+                       if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) {
                                p->RIOConnectTable[Next] = HostP->Mapping[Rup];
-                               if ( HostP->Mapping[Rup].Flags & SLOT_IN_USE)
+                               if (HostP->Mapping[Rup].Flags & SLOT_IN_USE)
                                        p->RIOConnectTable[Next].Flags |= SLOT_IN_USE;
-                               if ( HostP->Mapping[Rup].Flags & SLOT_TENTATIVE)
+                               if (HostP->Mapping[Rup].Flags & SLOT_TENTATIVE)
                                        p->RIOConnectTable[Next].Flags |= SLOT_TENTATIVE;
-                               if ( HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT )
+                               if (HostP->Mapping[Rup].Flags & RTA16_SECOND_SLOT)
                                        p->RIOConnectTable[Next].Flags |= RTA16_SECOND_SLOT;
                                Next++;
                        }
@@ -489,8 +463,7 @@ struct rio_info *   p;
 ** if the entry is suitably inactive, then we can gob on it and remove
 ** it from the table.
 */
-int
-RIODeleteRta(p, MapP)
+int RIODeleteRta(p, MapP)
 struct rio_info *p;
 struct Map *MapP;
 {
@@ -502,110 +475,98 @@ struct Map *MapP;
        int work_done = 0;
        unsigned long lock_flags, sem_flags;
 
-       rio_dprintk (RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n",
-                                                               MapP->HostUniqueNum, MapP->RtaUniqueNum);
+       rio_dprintk(RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n", MapP->HostUniqueNum, MapP->RtaUniqueNum);
 
-       for ( host=0; host < p->RIONumHosts; host++ ) {
+       for (host = 0; host < p->RIONumHosts; host++) {
                HostP = &p->RIOHosts[host];
 
-               rio_spin_lock_irqsave( &HostP->HostLock, lock_flags );
+               rio_spin_lock_irqsave(&HostP->HostLock, lock_flags);
 
-               if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) {
+               if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
                        rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
                        continue;
                }
 
-               for ( entry=0; entry<MAX_RUP; entry++ ) {
-                       if ( MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum ) {
+               for (entry = 0; entry < MAX_RUP; entry++) {
+                       if (MapP->RtaUniqueNum == HostP->Mapping[entry].RtaUniqueNum) {
                                HostMapP = &HostP->Mapping[entry];
-                               rio_dprintk (RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", 
-                                               entry, HostP->Name);
+                               rio_dprintk(RIO_DEBUG_TABLE, "Found entry offset %d on host %s\n", entry, HostP->Name);
 
                                /*
-                               ** Check all four links of the unit are disconnected
-                               */
-                               for ( link=0; link< LINKS_PER_UNIT; link++ ) {
-                                       if ( HostMapP->Topology[link].Unit != ROUTE_DISCONNECT ) {
-                                               rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n");
+                                ** Check all four links of the unit are disconnected
+                                */
+                               for (link = 0; link < LINKS_PER_UNIT; link++) {
+                                       if (HostMapP->Topology[link].Unit != ROUTE_DISCONNECT) {
+                                               rio_dprintk(RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n");
                                                p->RIOError.Error = UNIT_IS_IN_USE;
-                                               rio_spin_unlock_irqrestore( &HostP->HostLock, lock_flags);
+                                               rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
                                                return -EBUSY;
                                        }
                                }
                                /*
-                               ** Slot has been allocated, BUT not booted/routed/
-                               ** connected/selected or anything else-ed
-                               */
+                                ** Slot has been allocated, BUT not booted/routed/
+                                ** connected/selected or anything else-ed
+                                */
                                SysPort = HostMapP->SysPort;
 
-                               if ( SysPort != NO_PORT ) {
-                                       for (port=SysPort; port < SysPort+PORTS_PER_RTA; port++) {
+                               if (SysPort != NO_PORT) {
+                                       for (port = SysPort; port < SysPort + PORTS_PER_RTA; port++) {
                                                PortP = p->RIOPortp[port];
-                                               rio_dprintk (RIO_DEBUG_TABLE, "Unmap port\n");
+                                               rio_dprintk(RIO_DEBUG_TABLE, "Unmap port\n");
 
-                                               rio_spin_lock_irqsave( &PortP->portSem, sem_flags );
+                                               rio_spin_lock_irqsave(&PortP->portSem, sem_flags);
 
                                                PortP->Mapped = 0;
 
-                                               if ( PortP->State & (RIO_MOPEN|RIO_LOPEN) ) {
+                                               if (PortP->State & (RIO_MOPEN | RIO_LOPEN)) {
 
-                                                       rio_dprintk (RIO_DEBUG_TABLE, "Gob on port\n");
+                                                       rio_dprintk(RIO_DEBUG_TABLE, "Gob on port\n");
                                                        PortP->TxBufferIn = PortP->TxBufferOut = 0;
                                                        /* What should I do 
-                                                       wakeup( &PortP->TxBufferIn );
-                                                       wakeup( &PortP->TxBufferOut);
-                                                       */
+                                                          wakeup( &PortP->TxBufferIn );
+                                                          wakeup( &PortP->TxBufferOut);
+                                                        */
                                                        PortP->InUse = NOT_INUSE;
                                                        /* What should I do 
-                                                       wakeup( &PortP->InUse );
-                                                       signal(PortP->TtyP->t_pgrp,SIGKILL);
-                                                       ttyflush(PortP->TtyP,(FREAD|FWRITE));
-                                                       */
+                                                          wakeup( &PortP->InUse );
+                                                          signal(PortP->TtyP->t_pgrp,SIGKILL);
+                                                          ttyflush(PortP->TtyP,(FREAD|FWRITE));
+                                                        */
                                                        PortP->State |= RIO_CLOSING | RIO_DELETED;
                                                }
 
                                                /*
-                                               ** For the second slot of a 16 port RTA, the
-                                               ** driver needs to reset the changes made to
-                                               ** the phb to port mappings in RIORouteRup.
-                                               */
+                                                ** For the second slot of a 16 port RTA, the
+                                                ** driver needs to reset the changes made to
+                                                ** the phb to port mappings in RIORouteRup.
+                                                */
                                                if (PortP->SecondBlock) {
                                                        ushort dest_unit = HostMapP->ID;
                                                        ushort dest_port = port - SysPort;
-                                                       WORD     *TxPktP;
-                                                       PKT     *Pkt;
+                                                       WORD *TxPktP;
+                                                       PKT *Pkt;
 
-                                                       for (TxPktP = PortP->TxStart;
-                                                               TxPktP <= PortP->TxEnd; TxPktP++) {
+                                                       for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) {
                                                                /*
-                                                               ** *TxPktP is the pointer to the
-                                                               ** transmit packet on the host card.
-                                                               ** This needs to be translated into
-                                                               ** a 32 bit pointer so it can be
-                                                               ** accessed from the driver.
-                                                               */
-                                                               Pkt = (PKT *) RIO_PTR(HostP->Caddr,
-                                                                       RWORD(*TxPktP));
-                                                               rio_dprintk (RIO_DEBUG_TABLE, 
-                                               "Tx packet (%x) destination: Old %x:%x New %x:%x\n",
-                                                                *TxPktP, Pkt->dest_unit,
-                                                                Pkt->dest_port, dest_unit, dest_port);
+                                                                ** *TxPktP is the pointer to the
+                                                                ** transmit packet on the host card.
+                                                                ** This needs to be translated into
+                                                                ** a 32 bit pointer so it can be
+                                                                ** accessed from the driver.
+                                                                */
+                                                               Pkt = (PKT *) RIO_PTR(HostP->Caddr, RWORD(*TxPktP));
+                                                               rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, Pkt->dest_port, dest_unit, dest_port);
                                                                WWORD(Pkt->dest_unit, dest_unit);
                                                                WWORD(Pkt->dest_port, dest_port);
                                                        }
-                                                       rio_dprintk (RIO_DEBUG_TABLE, 
-                                               "Port %d phb destination: Old %x:%x New %x:%x\n",
-                                                        port, PortP->PhbP->destination & 0xff,
-                                                        (PortP->PhbP->destination >> 8) & 0xff,
-                                                        dest_unit, dest_port);
-                                                       WWORD(PortP->PhbP->destination,
-                                                        dest_unit + (dest_port << 8));
+                                                       rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, PortP->PhbP->destination & 0xff, (PortP->PhbP->destination >> 8) & 0xff, dest_unit, dest_port);
+                                                       WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8));
                                                }
                                                rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags);
                                        }
                                }
-                               rio_dprintk (RIO_DEBUG_TABLE, "Entry nulled.\n");
-                               bzero((char *)HostMapP,sizeof(struct Map));
+                               rio_dprintk(RIO_DEBUG_TABLE, "Entry nulled.\n");
+                               bzero((char *) HostMapP, sizeof(struct Map));
                                work_done++;
                        }
                }
@@ -613,203 +574,178 @@ struct Map *MapP;
        }
 
        /* XXXXX lock me up */
-       for ( entry=0; entry< TOTAL_MAP_ENTRIES; entry++ ) {
-               if ( p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum ) {
-                       bzero((char *)&p->RIOSavedTable[entry],sizeof(struct Map));
+       for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
+               if (p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) {
+                       bzero((char *) &p->RIOSavedTable[entry], sizeof(struct Map));
                        work_done++;
                }
-               if ( p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum ) {
-                       bzero((char *)&p->RIOConnectTable[entry],sizeof(struct Map));
+               if (p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) {
+                       bzero((char *) &p->RIOConnectTable[entry], sizeof(struct Map));
                        work_done++;
                }
        }
-       if ( work_done )
+       if (work_done)
                return 0;
 
-       rio_dprintk (RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n");
+       rio_dprintk(RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n");
        p->RIOError.Error = COULDNT_FIND_ENTRY;
        return -ENXIO;
 }
 
-int RIOAssignRta( struct rio_info *p, struct Map *MapP )
+int RIOAssignRta(struct rio_info *p, struct Map *MapP)
 {
-    int host;
-    struct Map *HostMapP;
-    char *sptr;
-    int        link;
-
-
-    rio_dprintk (RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n",
-                               MapP->HostUniqueNum,MapP->RtaUniqueNum,
-                               MapP->ID, (int)MapP->SysPort);
-
-    if ((MapP->ID != (ushort)-1) &&
-       ((int)MapP->ID < (int)1 || (int)MapP->ID > MAX_RUP ))
-    {
-       rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
-       p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
-       return -EINVAL;
-    }
-    if (MapP->RtaUniqueNum == 0)
-    {
-       rio_dprintk (RIO_DEBUG_TABLE, "Rta Unique number zero!\n");
-       p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO;
-       return -EINVAL;
-    }
-    if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA) )
-    {
-       rio_dprintk (RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n",(int)MapP->SysPort,PORTS_PER_RTA);
-       p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
-       return -EINVAL;
-    }
-    if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS) )
-    {
-       rio_dprintk (RIO_DEBUG_TABLE, "Port %d not valid!\n",(int)MapP->SysPort);
-       p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
-       return -EINVAL;
-    }
-
-    /*
-    ** Copy the name across to the map entry.
-    */
-    MapP->Name[MAX_NAME_LEN-1] = '\0';
-    sptr = MapP->Name;
-    while ( *sptr )
-    {
-    if ( *sptr<' ' || *sptr>'~' )
-    {
-       rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
-       p->RIOError.Error = BAD_CHARACTER_IN_NAME;
-       return -EINVAL;
-    }
-    sptr++;
-    }
-
-    for ( host=0; host < p->RIONumHosts; host++ )
-    {
-       if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum )
-       {
-           if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING )
-           {
-               p->RIOError.Error = HOST_NOT_RUNNING;
-               return -ENXIO;
-           }
-
-           /*
-           ** Now we have a host we need to allocate an ID
-           ** if the entry does not already have one.
-           */
-           if (MapP->ID == (ushort)-1)
-           {
-               int nNewID;
-
-               rio_dprintk (RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n",
-                     MapP->Name);
-               /*
-               ** The idea here is to allow RTA's to be assigned
-               ** before they actually appear on the network.
-               ** This allows the addition of RTA's without having
-               ** to plug them in.
-               ** What we do is:
-               **  - Find a free ID and allocate it to the RTA.
-               **  - If this map entry is the second half of a
-               **    16 port entry then find the other half and
-               **    make sure the 2 cross reference each other.
-               */
-               if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0)
-               {
-                   p->RIOError.Error = COULDNT_FIND_ENTRY;
-                   return -EBUSY;
-               }
-               MapP->ID = (ushort)nNewID + 1;
-               rio_dprintk (RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID);
-               HostMapP = &p->RIOHosts[host].Mapping[nNewID];
-               HostMapP->RtaUniqueNum = MapP->RtaUniqueNum;
-               HostMapP->HostUniqueNum = MapP->HostUniqueNum;
-               HostMapP->ID = MapP->ID;
-               for (link = 0; link < LINKS_PER_UNIT; link++)
-               {
-                   HostMapP->Topology[link].Unit = ROUTE_DISCONNECT;
-                   HostMapP->Topology[link].Link = NO_LINK;
-               }
-               if (MapP->Flags & RTA16_SECOND_SLOT)
-               {
-                   int unit;
-
-                   for (unit = 0; unit < MAX_RUP; unit++)
-                       if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum ==
-                           MapP->RtaUniqueNum)
-                           break;
-                   if (unit == MAX_RUP)
-                   {
-                       p->RIOError.Error = COULDNT_FIND_ENTRY;
-                       return -EBUSY;
-                   }
-                   HostMapP->Flags |= RTA16_SECOND_SLOT;
-                   HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID;
-                   p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID;
-                   rio_dprintk (RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n",
-                         MapP->ID,
-                         p->RIOHosts[host].Mapping[unit].ID);
+       int host;
+       struct Map *HostMapP;
+       char *sptr;
+       int link;
+
+
+       rio_dprintk(RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort);
+
+       if ((MapP->ID != (ushort) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) {
+               rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
+               p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
+               return -EINVAL;
+       }
+       if (MapP->RtaUniqueNum == 0) {
+               rio_dprintk(RIO_DEBUG_TABLE, "Rta Unique number zero!\n");
+               p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO;
+               return -EINVAL;
+       }
+       if ((MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA)) {
+               rio_dprintk(RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n", (int) MapP->SysPort, PORTS_PER_RTA);
+               p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
+               return -EINVAL;
+       }
+       if ((MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS)) {
+               rio_dprintk(RIO_DEBUG_TABLE, "Port %d not valid!\n", (int) MapP->SysPort);
+               p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
+               return -EINVAL;
+       }
+
+       /*
+        ** Copy the name across to the map entry.
+        */
+       MapP->Name[MAX_NAME_LEN - 1] = '\0';
+       sptr = MapP->Name;
+       while (*sptr) {
+               if (*sptr < ' ' || *sptr > '~') {
+                       rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
+                       p->RIOError.Error = BAD_CHARACTER_IN_NAME;
+                       return -EINVAL;
                }
-           }
+               sptr++;
+       }
+
+       for (host = 0; host < p->RIONumHosts; host++) {
+               if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) {
+                       if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) {
+                               p->RIOError.Error = HOST_NOT_RUNNING;
+                               return -ENXIO;
+                       }
 
-           HostMapP = &p->RIOHosts[host].Mapping[MapP->ID-1];
+                       /*
+                        ** Now we have a host we need to allocate an ID
+                        ** if the entry does not already have one.
+                        */
+                       if (MapP->ID == (ushort) - 1) {
+                               int nNewID;
 
-           if ( HostMapP->Flags & SLOT_IN_USE )
-           {
-               rio_dprintk (RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID);
-               p->RIOError.Error = ID_ALREADY_IN_USE;
-               return -EBUSY;
-           }
-
-           /*
-           ** Assign the sys ports and the name, and mark the slot as
-           ** being in use.
-           */
-           HostMapP->SysPort = MapP->SysPort;
-           if ((MapP->Flags & RTA16_SECOND_SLOT) == 0)
-             CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN );
-           HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED;
+                               rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name);
+                               /*
+                                ** The idea here is to allow RTA's to be assigned
+                                ** before they actually appear on the network.
+                                ** This allows the addition of RTA's without having
+                                ** to plug them in.
+                                ** What we do is:
+                                **  - Find a free ID and allocate it to the RTA.
+                                **  - If this map entry is the second half of a
+                                **    16 port entry then find the other half and
+                                **    make sure the 2 cross reference each other.
+                                */
+                               if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) {
+                                       p->RIOError.Error = COULDNT_FIND_ENTRY;
+                                       return -EBUSY;
+                               }
+                               MapP->ID = (ushort) nNewID + 1;
+                               rio_dprintk(RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID);
+                               HostMapP = &p->RIOHosts[host].Mapping[nNewID];
+                               HostMapP->RtaUniqueNum = MapP->RtaUniqueNum;
+                               HostMapP->HostUniqueNum = MapP->HostUniqueNum;
+                               HostMapP->ID = MapP->ID;
+                               for (link = 0; link < LINKS_PER_UNIT; link++) {
+                                       HostMapP->Topology[link].Unit = ROUTE_DISCONNECT;
+                                       HostMapP->Topology[link].Link = NO_LINK;
+                               }
+                               if (MapP->Flags & RTA16_SECOND_SLOT) {
+                                       int unit;
+
+                                       for (unit = 0; unit < MAX_RUP; unit++)
+                                               if (p->RIOHosts[host].Mapping[unit].RtaUniqueNum == MapP->RtaUniqueNum)
+                                                       break;
+                                       if (unit == MAX_RUP) {
+                                               p->RIOError.Error = COULDNT_FIND_ENTRY;
+                                               return -EBUSY;
+                                       }
+                                       HostMapP->Flags |= RTA16_SECOND_SLOT;
+                                       HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID;
+                                       p->RIOHosts[host].Mapping[unit].ID2 = MapP->ID;
+                                       rio_dprintk(RIO_DEBUG_TABLE, "Cross referenced id %d to ID %d.\n", MapP->ID, p->RIOHosts[host].Mapping[unit].ID);
+                               }
+                       }
+
+                       HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1];
+
+                       if (HostMapP->Flags & SLOT_IN_USE) {
+                               rio_dprintk(RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID);
+                               p->RIOError.Error = ID_ALREADY_IN_USE;
+                               return -EBUSY;
+                       }
+
+                       /*
+                        ** Assign the sys ports and the name, and mark the slot as
+                        ** being in use.
+                        */
+                       HostMapP->SysPort = MapP->SysPort;
+                       if ((MapP->Flags & RTA16_SECOND_SLOT) == 0)
+                               CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN);
+                       HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED;
 #ifdef NEED_TO_FIX
-           RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID-1]);
+                       RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID - 1]);
 #endif
-           if (MapP->Flags & RTA16_SECOND_SLOT)
-               HostMapP->Flags |= RTA16_SECOND_SLOT;
-
-           RIOReMapPorts( p, &p->RIOHosts[host], HostMapP );
-           /*
-           ** Adjust 2nd block of 8 phbs
-           */
-           if (MapP->Flags & RTA16_SECOND_SLOT)
-               RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1);
-
-           if ( HostMapP->SysPort != NO_PORT )
-           {
-               if ( HostMapP->SysPort < p->RIOFirstPortsBooted )
-                   p->RIOFirstPortsBooted = HostMapP->SysPort;
-               if ( HostMapP->SysPort > p->RIOLastPortsBooted )
-                   p->RIOLastPortsBooted = HostMapP->SysPort;
-           }
-           if (MapP->Flags & RTA16_SECOND_SLOT)
-               rio_dprintk (RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n",
-                p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name);
-           else
-               rio_dprintk (RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name);
-           return 0;
+                       if (MapP->Flags & RTA16_SECOND_SLOT)
+                               HostMapP->Flags |= RTA16_SECOND_SLOT;
+
+                       RIOReMapPorts(p, &p->RIOHosts[host], HostMapP);
+                       /*
+                        ** Adjust 2nd block of 8 phbs
+                        */
+                       if (MapP->Flags & RTA16_SECOND_SLOT)
+                               RIOFixPhbs(p, &p->RIOHosts[host], HostMapP->ID - 1);
+
+                       if (HostMapP->SysPort != NO_PORT) {
+                               if (HostMapP->SysPort < p->RIOFirstPortsBooted)
+                                       p->RIOFirstPortsBooted = HostMapP->SysPort;
+                               if (HostMapP->SysPort > p->RIOLastPortsBooted)
+                                       p->RIOLastPortsBooted = HostMapP->SysPort;
+                       }
+                       if (MapP->Flags & RTA16_SECOND_SLOT)
+                               rio_dprintk(RIO_DEBUG_TABLE, "Second map of RTA %s added to configuration\n", p->RIOHosts[host].Mapping[MapP->ID2 - 1].Name);
+                       else
+                               rio_dprintk(RIO_DEBUG_TABLE, "RTA %s added to configuration\n", MapP->Name);
+                       return 0;
+               }
        }
-    }
-    p->RIOError.Error = UNKNOWN_HOST_NUMBER;
-    rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
-    return -ENXIO;
+       p->RIOError.Error = UNKNOWN_HOST_NUMBER;
+       rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
+       return -ENXIO;
 }
 
 
-int
-RIOReMapPorts(p, HostP, HostMapP)
-struct rio_info *      p;
+int RIOReMapPorts(p, HostP, HostMapP)
+struct rio_info *p;
 struct Host *HostP;
-struct Map *HostMapP; 
+struct Map *HostMapP;
 {
        register struct Port *PortP;
        uint SubEnt;
@@ -819,135 +755,127 @@ struct Map *HostMapP;
        unsigned long flags;
 
 #ifdef CHECK
-       CheckHostP( HostP );
-       CheckHostMapP( HostMapP );
+       CheckHostP(HostP);
+       CheckHostMapP(HostMapP);
 #endif
 
-       rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int)HostMapP->SysPort, HostMapP->ID);
+       rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID);
 
        /*
-       ** We need to tell the UnixRups which sysport the rup corresponds to
-       */
-       HostP->UnixRups[HostMapP->ID-1].BaseSysPort = HostMapP->SysPort;
+        ** We need to tell the UnixRups which sysport the rup corresponds to
+        */
+       HostP->UnixRups[HostMapP->ID - 1].BaseSysPort = HostMapP->SysPort;
 
-       if ( HostMapP->SysPort == NO_PORT )
-               return(0);
+       if (HostMapP->SysPort == NO_PORT)
+               return (0);
 
        RtaType = GetUnitType(HostMapP->RtaUniqueNum);
-       rio_dprintk (RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n",
-                               (int)HostMapP->SysPort, (int)HostMapP->SysPort+PORTS_PER_RTA-1);
+       rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d-%d\n", (int) HostMapP->SysPort, (int) HostMapP->SysPort + PORTS_PER_RTA - 1);
 
        /*
-       ** now map each of its eight ports
-       */
-       for ( SubEnt=0; SubEnt<PORTS_PER_RTA; SubEnt++) {
-         rio_dprintk (RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", 
-                 SubEnt, (int)HostMapP->SysPort);
-               SysPort = HostMapP->SysPort+SubEnt;             /* portnumber within system */
-                                       /* portnumber on host */
-               
-               HostPort = (HostMapP->ID-1)*PORTS_PER_RTA+SubEnt; 
-
-               rio_dprintk (RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp);
+        ** now map each of its eight ports
+        */
+       for (SubEnt = 0; SubEnt < PORTS_PER_RTA; SubEnt++) {
+               rio_dprintk(RIO_DEBUG_TABLE, "subent = %d, HostMapP->SysPort = %d\n", SubEnt, (int) HostMapP->SysPort);
+               SysPort = HostMapP->SysPort + SubEnt;   /* portnumber within system */
+               /* portnumber on host */
+
+               HostPort = (HostMapP->ID - 1) * PORTS_PER_RTA + SubEnt;
+
+               rio_dprintk(RIO_DEBUG_TABLE, "c1 p = %p, p->rioPortp = %p\n", p, p->RIOPortp);
                PortP = p->RIOPortp[SysPort];
 #if 0
-               PortP->TtyP     = &p->channel[SysPort];
+               PortP->TtyP = &p->channel[SysPort];
 #endif
-               rio_dprintk (RIO_DEBUG_TABLE, "Map port\n");
+               rio_dprintk(RIO_DEBUG_TABLE, "Map port\n");
 
                /*
-               ** Point at all the real neat data structures
-               */
+                ** Point at all the real neat data structures
+                */
                rio_spin_lock_irqsave(&PortP->portSem, flags);
                PortP->HostP = HostP;
                PortP->Caddr = HostP->Caddr;
 
                /*
-               ** The PhbP cannot be filled in yet
-               ** unless the host has been booted
-               */
+                ** The PhbP cannot be filled in yet
+                ** unless the host has been booted
+                */
                if ((HostP->Flags & RUN_STATE) == RC_RUNNING) {
                        struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort];
-                       PortP->TxAdd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_add));
-                       PortP->TxStart =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_start));
-                       PortP->TxEnd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->tx_end));
-                       PortP->RxRemove=(WORD *)RIO_PTR(HostP->Caddr,
-                                                                       RWORD(PhbP->rx_remove));
-                       PortP->RxStart =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->rx_start));
-                       PortP->RxEnd =(WORD *)RIO_PTR(HostP->Caddr,RWORD(PhbP->rx_end));
-               }
-               else
+                       PortP->TxAdd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_add));
+                       PortP->TxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_start));
+                       PortP->TxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_end));
+                       PortP->RxRemove = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_remove));
+                       PortP->RxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_start));
+                       PortP->RxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_end));
+               } else
                        PortP->PhbP = NULL;
 
                /*
-               ** port related flags
-               */
-               PortP->HostPort = HostPort;
+                ** port related flags
+                */
+               PortP->HostPort = HostPort;
                /*
-               ** For each part of a 16 port RTA, RupNum is ID - 1.
-               */
+                ** For each part of a 16 port RTA, RupNum is ID - 1.
+                */
                PortP->RupNum = HostMapP->ID - 1;
                if (HostMapP->Flags & RTA16_SECOND_SLOT) {
-                       PortP->ID2                       = HostMapP->ID2 - 1;
-                       PortP->SecondBlock       = TRUE;
-               }
-               else {
-                       PortP->ID2                       = 0;
-                       PortP->SecondBlock       = FALSE;
+                       PortP->ID2 = HostMapP->ID2 - 1;
+                       PortP->SecondBlock = TRUE;
+               } else {
+                       PortP->ID2 = 0;
+                       PortP->SecondBlock = FALSE;
                }
-               PortP->RtaUniqueNum     = HostMapP->RtaUniqueNum;
+               PortP->RtaUniqueNum = HostMapP->RtaUniqueNum;
 
                /*
-               ** If the port was already mapped then thats all we need to do.
-               */
+                ** If the port was already mapped then thats all we need to do.
+                */
                if (PortP->Mapped) {
-                       rio_spin_unlock_irqrestore( &PortP->portSem, flags);
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                        continue;
-               }
-               else HostMapP->Flags &= ~RTA_NEWBOOT;
+               } else
+                       HostMapP->Flags &= ~RTA_NEWBOOT;
 
-               PortP->State             = 0;
-               PortP->Config           = 0;
+               PortP->State = 0;
+               PortP->Config = 0;
                /*
-               ** Check out the module type - if it is special (read only etc.)
-               ** then we need to set flags in the PortP->Config.
-               ** Note: For 16 port RTA, all ports are of the same type.
-               */
+                ** Check out the module type - if it is special (read only etc.)
+                ** then we need to set flags in the PortP->Config.
+                ** Note: For 16 port RTA, all ports are of the same type.
+                */
                if (RtaType == TYPE_RTA16) {
-                       PortP->Config |= p->RIOModuleTypes[HostP->UnixRups
-                               [HostMapP->ID-1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE];
+                       PortP->Config |= p->RIOModuleTypes[HostP->UnixRups[HostMapP->ID - 1].ModTypes].Flags[SubEnt % PORTS_PER_MODULE];
                } else {
-                       if ( SubEnt < PORTS_PER_MODULE )
-                               PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups
-                               [HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
+                       if (SubEnt < PORTS_PER_MODULE)
+                               PortP->Config |= p->RIOModuleTypes[LONYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
                        else
-                               PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups
-                               [HostMapP->ID-1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
+                               PortP->Config |= p->RIOModuleTypes[HINYBLE(HostP->UnixRups[HostMapP->ID - 1].ModTypes)].Flags[SubEnt % PORTS_PER_MODULE];
                }
 
                /*
-               ** more port related flags
-               */
-               PortP->PortState        = 0;
-               PortP->ModemLines       = 0;
-               PortP->ModemState       = 0;
-               PortP->CookMode         = COOK_WELL;
-               PortP->ParamSem         = 0;
-               PortP->FlushCmdBodge= 0;
-               PortP->WflushFlag       = 0;
-               PortP->MagicFlags       = 0;
-               PortP->Lock                     = 0;
-               PortP->Store            = 0;
-               PortP->FirstOpen        = 1;
+                ** more port related flags
+                */
+               PortP->PortState = 0;
+               PortP->ModemLines = 0;
+               PortP->ModemState = 0;
+               PortP->CookMode = COOK_WELL;
+               PortP->ParamSem = 0;
+               PortP->FlushCmdBodge = 0;
+               PortP->WflushFlag = 0;
+               PortP->MagicFlags = 0;
+               PortP->Lock = 0;
+               PortP->Store = 0;
+               PortP->FirstOpen = 1;
 
                /*
-               ** Buffers 'n things
-               */
-               PortP->RxDataStart      = 0;
-               PortP->Cor2Copy  = 0;
-               PortP->Name              = &HostMapP->Name[0];
+                ** Buffers 'n things
+                */
+               PortP->RxDataStart = 0;
+               PortP->Cor2Copy = 0;
+               PortP->Name = &HostMapP->Name[0];
 #ifdef STATS
-               bzero( (caddr_t)&PortP->Stat, sizeof(struct RIOStats) );
+               bzero((caddr_t) & PortP->Stat, sizeof(struct RIOStats));
 #endif
                PortP->statsGather = 0;
                PortP->txchars = 0;
@@ -955,90 +883,87 @@ struct Map *HostMapP;
                PortP->opens = 0;
                PortP->closes = 0;
                PortP->ioctls = 0;
-               if ( PortP->TxRingBuffer )
-                       bzero( PortP->TxRingBuffer, p->RIOBufferSize );
-               else if ( p->RIOBufferSize ) {
+               if (PortP->TxRingBuffer)
+                       bzero(PortP->TxRingBuffer, p->RIOBufferSize);
+               else if (p->RIOBufferSize) {
                        PortP->TxRingBuffer = sysbrk(p->RIOBufferSize);
-                       bzero( PortP->TxRingBuffer, p->RIOBufferSize );
+                       bzero(PortP->TxRingBuffer, p->RIOBufferSize);
                }
-               PortP->TxBufferOut      = 0;
-               PortP->TxBufferIn        = 0;
-               PortP->Debug            = 0;
+               PortP->TxBufferOut = 0;
+               PortP->TxBufferIn = 0;
+               PortP->Debug = 0;
                /*
-               ** LastRxTgl stores the state of the rx toggle bit for this
-               ** port, to be compared with the state of the next pkt received.
-               ** If the same, we have received the same rx pkt from the RTA
-               ** twice. Initialise to a value not equal to PHB_RX_TGL or 0.
-               */
-               PortP->LastRxTgl        = ~(uchar)PHB_RX_TGL;
+                ** LastRxTgl stores the state of the rx toggle bit for this
+                ** port, to be compared with the state of the next pkt received.
+                ** If the same, we have received the same rx pkt from the RTA
+                ** twice. Initialise to a value not equal to PHB_RX_TGL or 0.
+                */
+               PortP->LastRxTgl = ~(uchar) PHB_RX_TGL;
 
                /*
-               ** and mark the port as usable
-               */
+                ** and mark the port as usable
+                */
                PortP->Mapped = 1;
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
        }
-       if ( HostMapP->SysPort < p->RIOFirstPortsMapped )
+       if (HostMapP->SysPort < p->RIOFirstPortsMapped)
                p->RIOFirstPortsMapped = HostMapP->SysPort;
-       if ( HostMapP->SysPort > p->RIOLastPortsMapped )
+       if (HostMapP->SysPort > p->RIOLastPortsMapped)
                p->RIOLastPortsMapped = HostMapP->SysPort;
 
        return 0;
 }
 
-int
-RIOChangeName(p, MapP)
+int RIOChangeName(p, MapP)
 struct rio_info *p;
-struct Map* MapP; 
+struct Map *MapP;
 {
        int host;
        struct Map *HostMapP;
        char *sptr;
 
-       rio_dprintk (RIO_DEBUG_TABLE, "Change name entry on host %x, rta %x, ID %d, Sysport %d\n",
-                                                               MapP->HostUniqueNum,MapP->RtaUniqueNum,
-                                                               MapP->ID, (int)MapP->SysPort);
+       rio_dprintk(RIO_DEBUG_TABLE, "Change name entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort);
 
-       if ( MapP->ID > MAX_RUP ) {
-               rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
+       if (MapP->ID > MAX_RUP) {
+               rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
                p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
                return -EINVAL;
        }
 
-       MapP->Name[MAX_NAME_LEN-1] = '\0';
+       MapP->Name[MAX_NAME_LEN - 1] = '\0';
        sptr = MapP->Name;
 
-       while ( *sptr ) {
-               if ( *sptr<' ' || *sptr>'~' ) {
-                       rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
+       while (*sptr) {
+               if (*sptr < ' ' || *sptr > '~') {
+                       rio_dprintk(RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
                        p->RIOError.Error = BAD_CHARACTER_IN_NAME;
                        return -EINVAL;
                }
                sptr++;
        }
 
-       for ( host=0; host < p->RIONumHosts; host++ ) {
-               if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum ) {
-                       if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING ) {
+       for (host = 0; host < p->RIONumHosts; host++) {
+               if (MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum) {
+                       if ((p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING) {
                                p->RIOError.Error = HOST_NOT_RUNNING;
                                return -ENXIO;
                        }
-                       if ( MapP->ID==0 ) {
-                               CCOPY( MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN );
+                       if (MapP->ID == 0) {
+                               CCOPY(MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN);
                                return 0;
                        }
 
-                       HostMapP = &p->RIOHosts[host].Mapping[MapP->ID-1];
+                       HostMapP = &p->RIOHosts[host].Mapping[MapP->ID - 1];
 
-                       if ( HostMapP->RtaUniqueNum != MapP->RtaUniqueNum ) {
+                       if (HostMapP->RtaUniqueNum != MapP->RtaUniqueNum) {
                                p->RIOError.Error = RTA_NUMBER_WRONG;
                                return -ENXIO;
                        }
-                       CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN );
+                       CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN);
                        return 0;
                }
        }
        p->RIOError.Error = UNKNOWN_HOST_NUMBER;
-       rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
+       rio_dprintk(RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
        return -ENXIO;
 }
index 66d52bc0549b900a5762ed95133f5f9d5c8710f9..35e01cd103d065d724a99379beef13fe4ca02563 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 #ifdef SCCS
-static char *_rio_riotime_h_sccs = "@(#)riotime.h      1.1" ;
+static char *_rio_riotime_h_sccs = "@(#)riotime.h      1.1";
 #endif
 #endif
 
@@ -52,7 +52,7 @@ static char *_rio_riotime_h_sccs = "@(#)riotime.h     1.1" ;
 /**************************************
  * Convert a RIO tick (1/10th second)
  * into transputer low priority ticks
- *************************************/ 
+ *************************************/
 #define RioTimeToLow(time) (time*(100000 / 64))
 #define RioLowToTime(time) ((time*64)/100000)
 
index 78a321afdf4fec6eba9e754dbb0b461fc633a0ad..5894a25b01137f5d623d3f3d887cd8b77dd39829 100644 (file)
@@ -90,21 +90,19 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c        1.3";
 #include "sam.h"
 
 #if 0
-static void ttyseth_pv(struct Port *, struct ttystatics *, 
-                               struct termios *sg, int);
+static void ttyseth_pv(struct Port *, struct ttystatics *, struct termios *sg, int);
 #endif
 
 static void RIOClearUp(struct Port *PortP);
-int RIOShortCommand(struct rio_info *p, struct Port *PortP, 
-                          int command, int len, int arg);
+int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
 
 #if 0
 static int RIOCookMode(struct ttystatics *);
 #endif
 
-extern int     conv_vb[];      /* now defined in ttymgr.c */
-extern int     conv_bv[];      /* now defined in ttymgr.c */
+extern int conv_vb[];          /* now defined in ttymgr.c */
+extern int conv_bv[];          /* now defined in ttymgr.c */
+
 /*
 ** 16.09.1998 ARG - Fix to build riotty.k.o for Modular Kernel Support
 **
@@ -117,27 +115,25 @@ extern int        conv_bv[];      /* now defined in ttymgr.c */
 #endif
 
 #ifdef NEED_THIS2
-static struct old_sgttyb 
-default_sg = 
-{ 
-       B19200, B19200,                         /* input and output speed */ 
-       'H' - '@',                                      /* erase char */ 
-       -1,                                                     /* 2nd erase char */ 
-       'U' - '@',                                      /* kill char */ 
-       ECHO | CRMOD,                           /* mode */ 
-       'C' - '@',                                      /* interrupt character */ 
-       '\\' - '@',                                     /* quit char */ 
-       'Q' - '@',                                      /* start char */
-       'S' - '@',                                      /* stop char */ 
-       'D' - '@',                                      /* EOF */
-       -1,                                                     /* brk */
-       (LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */ 
-       'Z' - '@',                                      /* process stop */
-       'Y' - '@',                                      /* delayed stop */
-       'R' - '@',                                      /* reprint line */ 
-       'O' - '@',                                      /* flush output */
-       'W' - '@',                                      /* word erase */
-       'V' - '@'                                       /* literal next char */
+static struct old_sgttyb default_sg = {
+       B19200, B19200,         /* input and output speed */
+       'H' - '@',              /* erase char */
+       -1,                     /* 2nd erase char */
+       'U' - '@',              /* kill char */
+       ECHO | CRMOD,           /* mode */
+       'C' - '@',              /* interrupt character */
+       '\\' - '@',             /* quit char */
+       'Q' - '@',              /* start char */
+       'S' - '@',              /* stop char */
+       'D' - '@',              /* EOF */
+       -1,                     /* brk */
+       (LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */
+       'Z' - '@',              /* process stop */
+       'Y' - '@',              /* delayed stop */
+       'R' - '@',              /* reprint line */
+       'O' - '@',              /* flush output */
+       'W' - '@',              /* word erase */
+       'V' - '@'               /* literal next char */
 };
 #endif
 
@@ -145,62 +141,59 @@ default_sg =
 extern struct rio_info *p;
 
 
-int
-riotopen(struct tty_struct * tty, struct file * filp)
+int riotopen(struct tty_struct *tty, struct file *filp)
 {
        register uint SysPort;
        int Modem;
        int repeat_this = 250;
-       struct Port *PortP;              /* pointer to the port structure */
+       struct Port *PortP;     /* pointer to the port structure */
        unsigned long flags;
        int retval = 0;
 
-       func_enter ();
+       func_enter();
 
        /* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close
           is going to oops.
-       */
+        */
        tty->driver_data = NULL;
-        
+
        SysPort = rio_minor(tty);
-       Modem   = rio_ismodem(tty);
+       Modem = rio_ismodem(tty);
 
-       if ( p->RIOFailed ) {
-               rio_dprintk (RIO_DEBUG_TTY, "System initialisation failed\n");
+       if (p->RIOFailed) {
+               rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n");
                pseterr(ENXIO);
-               func_exit ();
+               func_exit();
                return -ENXIO;
        }
 
-       rio_dprintk (RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n",
-              SysPort,  Modem ? "Modem" : "tty",
-                                  p->RIOPortp[SysPort]->Mapped);
+       rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", SysPort, Modem ? "Modem" : "tty", p->RIOPortp[SysPort]->Mapped);
 
        /*
-       ** Validate that we have received a legitimate request.
-       ** Currently, just check that we are opening a port on
-       ** a host card that actually exists, and that the port
-       ** has been mapped onto a host.
-       */
+        ** Validate that we have received a legitimate request.
+        ** Currently, just check that we are opening a port on
+        ** a host card that actually exists, and that the port
+        ** has been mapped onto a host.
+        */
        if (SysPort >= RIO_PORTS) {     /* out of range ? */
-               rio_dprintk (RIO_DEBUG_TTY, "Illegal port number %d\n",SysPort);
+               rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort);
                pseterr(ENXIO);
                func_exit();
                return -ENXIO;
        }
 
        /*
-       ** Grab pointer to the port stucture
-       */
+        ** Grab pointer to the port stucture
+        */
        PortP = p->RIOPortp[SysPort];   /* Get control struc */
-       rio_dprintk (RIO_DEBUG_TTY, "PortP: %p\n", PortP);
-       if ( !PortP->Mapped ) { /* we aren't mapped yet! */
+       rio_dprintk(RIO_DEBUG_TTY, "PortP: %p\n", PortP);
+       if (!PortP->Mapped) {   /* we aren't mapped yet! */
                /*
-               ** The system doesn't know which RTA this port
-               ** corresponds to.
-               */
-               rio_dprintk (RIO_DEBUG_TTY, "port not mapped into system\n");
-               func_exit ();
+                ** The system doesn't know which RTA this port
+                ** corresponds to.
+                */
+               rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n");
+               func_exit();
                pseterr(ENXIO);
                return -ENXIO;
        }
@@ -210,132 +203,131 @@ riotopen(struct tty_struct * tty, struct file * filp)
        PortP->gs.tty = tty;
        PortP->gs.count++;
 
-       rio_dprintk (RIO_DEBUG_TTY, "%d bytes in tx buffer\n",
-                                  PortP->gs.xmit_cnt);
+       rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
 
-       retval = gs_init_port (&PortP->gs);
+       retval = gs_init_port(&PortP->gs);
        if (retval) {
                PortP->gs.count--;
                return -ENXIO;
        }
        /*
-       ** If the host hasn't been booted yet, then 
-       ** fail
-       */
-       if ( (PortP->HostP->Flags & RUN_STATE) != RC_RUNNING ) {
-               rio_dprintk (RIO_DEBUG_TTY, "Host not running\n");
+        ** If the host hasn't been booted yet, then
+        ** fail
+        */
+       if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) {
+               rio_dprintk(RIO_DEBUG_TTY, "Host not running\n");
                pseterr(ENXIO);
-               func_exit ();
+               func_exit();
                return -ENXIO;
        }
 
        /*
-       ** If the RTA has not booted yet and the user has choosen to block
-       ** until the RTA is present then we must spin here waiting for
-       ** the RTA to boot.
-       */
+        ** If the RTA has not booted yet and the user has choosen to block
+        ** until the RTA is present then we must spin here waiting for
+        ** the RTA to boot.
+        */
 #if 0
        if (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
                if (PortP->WaitUntilBooted) {
-                       rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot\n");
+                       rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot\n");
                        do {
                                if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
-                                       rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n");
-                                       func_exit ();
+                                       rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
+                                       func_exit();
                                        return -EINTR;
                                }
-                               if (repeat_this -- <= 0) {
-                                       rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
-                                       RIOPreemptiveCmd(p, PortP, FCLOSE ); 
+                               if (repeat_this-- <= 0) {
+                                       rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
+                                       RIOPreemptiveCmd(p, PortP, FCLOSE);
                                        pseterr(EINTR);
-                                       func_exit ();
+                                       func_exit();
                                        return -EIO;
                                }
-                       } while(!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED));
-                       rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n");
+                       } while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED));
+                       rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
                } else {
-                       rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n");
+                       rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n");
                        pseterr(ENXIO);
-                       func_exit ();
+                       func_exit();
                        return 0;
                }
        }
 #else
        /* I find the above code a bit hairy. I find the below code
-           easier to read and shorter. Now, if it works too that would
+          easier to read and shorter. Now, if it works too that would
           be great... -- REW 
-       */
-       rio_dprintk (RIO_DEBUG_TTY, "Checking if RTA has booted... \n");
+        */
+       rio_dprintk(RIO_DEBUG_TTY, "Checking if RTA has booted... \n");
        while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
-         if (!PortP->WaitUntilBooted) {
-           rio_dprintk (RIO_DEBUG_TTY, "RTA never booted\n");
-           func_exit ();
-           return -ENXIO;
-         }
-
-         /* Under Linux you'd normally use a wait instead of this
-            busy-waiting. I'll stick with the old implementation for
-            now. --REW 
-         */
-         if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
-           rio_dprintk (RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n");
-           func_exit ();
-           return -EINTR;
-         }
-         if (repeat_this -- <= 0) {
-           rio_dprintk (RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
-           func_exit ();
-           return -EIO;
-         }
+               if (!PortP->WaitUntilBooted) {
+                       rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n");
+                       func_exit();
+                       return -ENXIO;
+               }
+
+               /* Under Linux you'd normally use a wait instead of this
+                  busy-waiting. I'll stick with the old implementation for
+                  now. --REW
+                */
+               if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
+                       rio_dprintk(RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n");
+                       func_exit();
+                       return -EINTR;
+               }
+               if (repeat_this-- <= 0) {
+                       rio_dprintk(RIO_DEBUG_TTY, "Waiting for RTA to boot timeout\n");
+                       func_exit();
+                       return -EIO;
+               }
        }
-       rio_dprintk (RIO_DEBUG_TTY, "RTA has been booted\n");
+       rio_dprintk(RIO_DEBUG_TTY, "RTA has been booted\n");
 #endif
 #if 0
-       tp =  PortP->TtyP;              /* get tty struct */
+       tp = PortP->TtyP;       /* get tty struct */
 #endif
        rio_spin_lock_irqsave(&PortP->portSem, flags);
-       if ( p->RIOHalted ) {
+       if (p->RIOHalted) {
                goto bombout;
        }
 #if 0
        retval = gs_init_port(&PortP->gs);
-       if (retval){
-               func_exit ();
+       if (retval) {
+               func_exit();
                return retval;
        }
 #endif
 
        /*
-       ** If the port is in the final throws of being closed,
-       ** we should wait here (politely), waiting
-       ** for it to finish, so that it doesn't close us!
-       */
-       while ( (PortP->State & RIO_CLOSING) && !p->RIOHalted ) {
-               rio_dprintk (RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n");
-               if (repeat_this -- <= 0) {
-                       rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
-                       RIOPreemptiveCmd(p, PortP, FCLOSE ); 
+        ** If the port is in the final throws of being closed,
+        ** we should wait here (politely), waiting
+        ** for it to finish, so that it doesn't close us!
+        */
+       while ((PortP->State & RIO_CLOSING) && !p->RIOHalted) {
+               rio_dprintk(RIO_DEBUG_TTY, "Waiting for RIO_CLOSING to go away\n");
+               if (repeat_this-- <= 0) {
+                       rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
+                       RIOPreemptiveCmd(p, PortP, FCLOSE);
                        retval = -EINTR;
                        goto bombout;
                }
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
-                       rio_spin_lock_irqsave(&PortP->portSem, flags); 
+                       rio_spin_lock_irqsave(&PortP->portSem, flags);
                        retval = -EINTR;
                        goto bombout;
                }
-               rio_spin_lock_irqsave(&PortP->portSem, flags); 
+               rio_spin_lock_irqsave(&PortP->portSem, flags);
        }
 
-       if ( !PortP->Mapped ) {
-               rio_dprintk (RIO_DEBUG_TTY, "Port unmapped while closing!\n");
+       if (!PortP->Mapped) {
+               rio_dprintk(RIO_DEBUG_TTY, "Port unmapped while closing!\n");
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                retval = -ENXIO;
-               func_exit ();
+               func_exit();
                return retval;
        }
 
-       if ( p->RIOHalted ) {
+       if (p->RIOHalted) {
                goto bombout;
        }
 
@@ -346,16 +338,16 @@ riotopen(struct tty_struct * tty, struct file * filp)
 */
        /* Uh? Suppose I turn these on and then another process opens
           the port again? The flags get cleared! Not good. -- REW */
-       if ( !(PortP->State & (RIO_LOPEN | RIO_MOPEN)) ) {
-               PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW);
+       if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
+               PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW);
        }
 
        if (!(PortP->firstOpen)) {      /* First time ? */
-               rio_dprintk (RIO_DEBUG_TTY, "First open for this port\n");
-       
+               rio_dprintk(RIO_DEBUG_TTY, "First open for this port\n");
+
 
                PortP->firstOpen++;
-               PortP->CookMode = 0; /* XXX RIOCookMode(tp); */
+               PortP->CookMode = 0;    /* XXX RIOCookMode(tp); */
                PortP->InUse = NOT_INUSE;
 
                /* Tentative fix for bug PR27. Didn't work. */
@@ -363,26 +355,26 @@ riotopen(struct tty_struct * tty, struct file * filp)
 
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
 #ifdef NEED_THIS
-               ttyseth(PortP, tp, (struct old_sgttyb *)&default_sg);
+               ttyseth(PortP, tp, (struct old_sgttyb *) &default_sg);
 #endif
 
                /* Someone explain to me why this delay/config is
-                   here. If I read the docs correctly the "open"
-                   command piggybacks the parameters immediately. 
+                  here. If I read the docs correctly the "open"
+                  command piggybacks the parameters immediately.
                   -- REW */
-               RIOParam(PortP,OPEN,Modem,OK_TO_SLEEP);         /* Open the port */
+               RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP);      /* Open the port */
 #if 0
                /* This delay of 1 second was annoying. I removed it. -- REW */
-               RIODelay(PortP, HUNDRED_MS*10);
-               RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP);       /* Config the port */
+               RIODelay(PortP, HUNDRED_MS * 10);
+               RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);    /* Config the port */
 #endif
                rio_spin_lock_irqsave(&PortP->portSem, flags);
 
                /*
-               ** wait for the port to be not closed.
-               */
-               while ( !(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted ) {
-                       rio_dprintk (RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n",PortP->PortState);
+                ** wait for the port to be not closed.
+                */
+               while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) {
+                       rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState);
 /*
 ** 15.10.1998 ARG - ESIL 0759
 ** (Part) fix for port being trashed when opened whilst RTA "disconnected"
@@ -399,115 +391,109 @@ riotopen(struct tty_struct * tty, struct file * filp)
 */
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                        if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
-                               rio_dprintk (RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n");
-                               RIOPreemptiveCmd(p, PortP, FCLOSE );
-                               func_exit ();
+                               rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n");
+                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                               func_exit();
                                return -EINTR;
                        }
                        rio_spin_lock_irqsave(&PortP->portSem, flags);
                }
 
-               if ( p->RIOHalted ) {
-                 retval = -EIO;
-bombout:
-                 /*                    RIOClearUp( PortP ); */
+               if (p->RIOHalted) {
+                       retval = -EIO;
+                     bombout:
+                       /*                    RIOClearUp( PortP ); */
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                        return retval;
                }
-               rio_dprintk (RIO_DEBUG_TTY, "PORT_ISOPEN found\n");
+               rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n");
        }
-
-#ifdef MODEM_SUPPORT 
+#ifdef MODEM_SUPPORT
        if (Modem) {
-               rio_dprintk (RIO_DEBUG_TTY, "Modem - test for carrier\n");
+               rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n");
                /*
-               ** ACTION
-               ** insert test for carrier here. -- ???
-               ** I already see that test here. What's the deal? -- REW
-               */
-               if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD))
-               {
-                       rio_dprintk (RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
+                ** ACTION
+                ** insert test for carrier here. -- ???
+                ** I already see that test here. What's the deal? -- REW
+                */
+               if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
+                       rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort);
                        /*
-                       tp->tm.c_state |= CARR_ON;
-                       wakeup((caddr_t) &tp->tm.c_canq);
-                       */
+                          tp->tm.c_state |= CARR_ON;
+                          wakeup((caddr_t) &tp->tm.c_canq);
+                        */
                        PortP->State |= RIO_CARR_ON;
-                       wake_up_interruptible (&PortP->gs.open_wait);
-               }
-               else /* no carrier - wait for DCD */
-               {
-                 /*
-                       while (!(PortP->gs.tty->termios->c_state & CARR_ON) && 
-                              !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
-                 */
-                       while (!(PortP->State & RIO_CARR_ON) && 
-                              !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) {
-
-                               rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n",SysPort);
+                       wake_up_interruptible(&PortP->gs.open_wait);
+               } else {        /* no carrier - wait for DCD */
+
+                       /*
+                          while (!(PortP->gs.tty->termios->c_state & CARR_ON) &&
+                          !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted )
+                        */
+                       while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
+
+                               rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort);
                                /*
-                               PortP->gs.tty->termios->c_state |= WOPEN;
-                               */
+                                  PortP->gs.tty->termios->c_state |= WOPEN;
+                                */
                                PortP->State |= RIO_WOPEN;
                                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                               if (RIODelay (PortP, HUNDRED_MS) == RIO_FAIL)
+                               if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL)
 #if 0
-                               if ( sleep((caddr_t)&tp->tm.c_canqo, TTIPRI|PCATCH))
+                                       if (sleep((caddr_t) & tp->tm.c_canqo, TTIPRI | PCATCH))
 #endif
-                               {
-                                       /*
-                                       ** ACTION: verify that this is a good thing
-                                       ** to do here. -- ???
-                                       ** I think it's OK. -- REW
-                                       */
-                                       rio_dprintk (RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n",
-                                              SysPort);
-                                       RIOPreemptiveCmd( p, PortP, FCLOSE );
-                                       /*
-                                       tp->tm.c_state &= ~WOPEN;
-                                       */
-                                       PortP->State &= ~RIO_WOPEN;
-                                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                                       func_exit ();
-                                       return -EINTR;
-                               }
+                                       {
+                                               /*
+                                                ** ACTION: verify that this is a good thing
+                                                ** to do here. -- ???
+                                                ** I think it's OK. -- REW
+                                                */
+                                               rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort);
+                                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                                               /*
+                                                  tp->tm.c_state &= ~WOPEN;
+                                                */
+                                               PortP->State &= ~RIO_WOPEN;
+                                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                                               func_exit();
+                                               return -EINTR;
+                                       }
                        }
                        PortP->State &= ~RIO_WOPEN;
                }
-               if ( p->RIOHalted )
+               if (p->RIOHalted)
                        goto bombout;
-               rio_dprintk (RIO_DEBUG_TTY, "Setting RIO_MOPEN\n");
+               rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n");
                PortP->State |= RIO_MOPEN;
-       }
-       else
+       } else
 #endif
        {
                /*
-               ** ACTION
-               ** Direct line open - force carrier (will probably mean
-               ** that sleeping Modem line fubar)
-               */
+                ** ACTION
+                ** Direct line open - force carrier (will probably mean
+                ** that sleeping Modem line fubar)
+                */
                PortP->State |= RIO_LOPEN;
        }
 
-       if ( p->RIOHalted ) {
+       if (p->RIOHalted) {
                goto bombout;
        }
 
-       rio_dprintk (RIO_DEBUG_TTY, "high level open done\n");
+       rio_dprintk(RIO_DEBUG_TTY, "high level open done\n");
 
 #ifdef STATS
        PortP->Stat.OpenCnt++;
 #endif
        /*
-       ** Count opens for port statistics reporting
-       */
+        ** Count opens for port statistics reporting
+        */
        if (PortP->statsGather)
                PortP->opens++;
 
        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-       rio_dprintk (RIO_DEBUG_TTY, "Returning from open\n");
-       func_exit ();
+       rio_dprintk(RIO_DEBUG_TTY, "Returning from open\n");
+       func_exit();
        return 0;
 }
 
@@ -516,36 +502,35 @@ bombout:
 ** The operating system thinks that this is last close for the device.
 ** As there are two interfaces to the port (Modem and tty), we need to
 ** check that both are closed before we close the device.
-*/ 
-int
-riotclose(void  *ptr)
+*/
+int riotclose(void *ptr)
 {
 #if 0
        register uint SysPort = dev;
-       struct ttystatics *tp;          /* pointer to our ttystruct */
+       struct ttystatics *tp;  /* pointer to our ttystruct */
 #endif
        struct Port *PortP = ptr;       /* pointer to the port structure */
        int deleted = 0;
-       int     try = -1; /* Disable the timeouts by setting them to -1 */
-       int     repeat_this = -1; /* Congrats to those having 15 years of 
-                                    uptime! (You get to break the driver.) */
+       int try = -1;           /* Disable the timeouts by setting them to -1 */
+       int repeat_this = -1;   /* Congrats to those having 15 years of
+                                  uptime! (You get to break the driver.) */
        unsigned long end_time;
-       struct tty_struct * tty;
+       struct tty_struct *tty;
        unsigned long flags;
        int Modem;
        int rv = 0;
-       
-       rio_dprintk (RIO_DEBUG_TTY, "port close SysPort %d\n",PortP->PortNum);
+
+       rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum);
 
        /* PortP = p->RIOPortp[SysPort]; */
-       rio_dprintk (RIO_DEBUG_TTY, "Port is at address 0x%x\n",(int)PortP);
-       /* tp = PortP->TtyP;*/                  /* Get tty */
+       rio_dprintk(RIO_DEBUG_TTY, "Port is at address 0x%x\n", (int) PortP);
+       /* tp = PortP->TtyP; *//* Get tty */
        tty = PortP->gs.tty;
-       rio_dprintk (RIO_DEBUG_TTY, "TTY is at address 0x%x\n",(int)tty);
+       rio_dprintk(RIO_DEBUG_TTY, "TTY is at address 0x%x\n", (int) tty);
 
-       if (PortP->gs.closing_wait) 
+       if (PortP->gs.closing_wait)
                end_time = jiffies + PortP->gs.closing_wait;
-       else 
+       else
                end_time = jiffies + MAX_SCHEDULE_TIMEOUT;
 
        Modem = rio_ismodem(tty);
@@ -553,48 +538,48 @@ riotclose(void  *ptr)
        /* What F.CKING cache? Even then, a higly idle multiprocessor,
           system with large caches this won't work . Better find out when 
           this doesn't work asap, and fix the cause.  -- REW */
-       
-       RIODelay(PortP, HUNDRED_MS*10); /* To flush the cache */
+
+       RIODelay(PortP, HUNDRED_MS * 10);       /* To flush the cache */
 #endif
        rio_spin_lock_irqsave(&PortP->portSem, flags);
 
        /*
-       ** Setting this flag will make any process trying to open
-       ** this port block until we are complete closing it.
-       */
+        ** Setting this flag will make any process trying to open
+        ** this port block until we are complete closing it.
+        */
        PortP->State |= RIO_CLOSING;
 
-       if ( (PortP->State & RIO_DELETED) ) {
-               rio_dprintk (RIO_DEBUG_TTY, "Close on deleted RTA\n");
+       if ((PortP->State & RIO_DELETED)) {
+               rio_dprintk(RIO_DEBUG_TTY, "Close on deleted RTA\n");
                deleted = 1;
        }
-       
-       if ( p->RIOHalted ) {
-               RIOClearUp( PortP );
+
+       if (p->RIOHalted) {
+               RIOClearUp(PortP);
                rv = -EIO;
                goto close_end;
        }
 
-       rio_dprintk (RIO_DEBUG_TTY, "Clear bits\n");
+       rio_dprintk(RIO_DEBUG_TTY, "Clear bits\n");
        /*
-       ** clear the open bits for this device
-       */
+        ** clear the open bits for this device
+        */
        PortP->State &= (Modem ? ~RIO_MOPEN : ~RIO_LOPEN);
        PortP->State &= ~RIO_CARR_ON;
        PortP->ModemState &= ~MSVR1_CD;
        /*
-       ** If the device was open as both a Modem and a tty line
-       ** then we need to wimp out here, as the port has not really
-       ** been finally closed (gee, whizz!) The test here uses the
-       ** bit for the OTHER mode of operation, to see if THAT is
-       ** still active!
-       */
-       if ( (PortP->State & (RIO_LOPEN|RIO_MOPEN)) ) {
+        ** If the device was open as both a Modem and a tty line
+        ** then we need to wimp out here, as the port has not really
+        ** been finally closed (gee, whizz!) The test here uses the
+        ** bit for the OTHER mode of operation, to see if THAT is
+        ** still active!
+        */
+       if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
                /*
-               ** The port is still open for the other task -
-               ** return, pretending that we are still active.
-               */
-               rio_dprintk (RIO_DEBUG_TTY, "Channel %d still open !\n",PortP->PortNum);
+                ** The port is still open for the other task -
+                ** return, pretending that we are still active.
+                */
+               rio_dprintk(RIO_DEBUG_TTY, "Channel %d still open !\n", PortP->PortNum);
                PortP->State &= ~RIO_CLOSING;
                if (PortP->firstOpen)
                        PortP->firstOpen--;
@@ -602,48 +587,47 @@ riotclose(void  *ptr)
                return -EIO;
        }
 
-       rio_dprintk (RIO_DEBUG_TTY, "Closing down - everything must go!\n");
+       rio_dprintk(RIO_DEBUG_TTY, "Closing down - everything must go!\n");
 
        PortP->State &= ~RIO_DYNOROD;
 
        /*
-       ** This is where we wait for the port
-       ** to drain down before closing. Bye-bye....
-       ** (We never meant to do this)
-       */
-       rio_dprintk (RIO_DEBUG_TTY, "Timeout 1 starts\n");
+        ** This is where we wait for the port
+        ** to drain down before closing. Bye-bye....
+        ** (We never meant to do this)
+        */
+       rio_dprintk(RIO_DEBUG_TTY, "Timeout 1 starts\n");
 
        if (!deleted)
-       while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted && 
-               (PortP->TxBufferIn != PortP->TxBufferOut) ) {
-               cprintf("Need to flush the ttyport\n");
-               if (repeat_this -- <= 0) {
-                       rv = -EINTR;
-                       rio_dprintk (RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
-                       RIOPreemptiveCmd(p, PortP, FCLOSE);
-                       goto close_end;
-               }
-               rio_dprintk (RIO_DEBUG_TTY, "Calling timeout to flush in closing\n");
-               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-               if (RIODelay_ni(PortP, HUNDRED_MS*10) == RIO_FAIL) {
-                       rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n");
-                       rv = -EINTR;
+               while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) {
+                       cprintf("Need to flush the ttyport\n");
+                       if (repeat_this-- <= 0) {
+                               rv = -EINTR;
+                               rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
+                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                               goto close_end;
+                       }
+                       rio_dprintk(RIO_DEBUG_TTY, "Calling timeout to flush in closing\n");
+                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                       if (RIODelay_ni(PortP, HUNDRED_MS * 10) == RIO_FAIL) {
+                               rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
+                               rv = -EINTR;
+                               rio_spin_lock_irqsave(&PortP->portSem, flags);
+                               goto close_end;
+                       }
                        rio_spin_lock_irqsave(&PortP->portSem, flags);
-                       goto close_end;
                }
-               rio_spin_lock_irqsave(&PortP->portSem, flags);
-       }
 
        PortP->TxBufferIn = PortP->TxBufferOut = 0;
        repeat_this = 0xff;
 
        PortP->InUse = 0;
-       if ( (PortP->State & (RIO_LOPEN|RIO_MOPEN)) ) {
+       if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
                /*
-               ** The port has been re-opened for the other task -
-               ** return, pretending that we are still active.
-               */
-               rio_dprintk (RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum);
+                ** The port has been re-opened for the other task -
+                ** return, pretending that we are still active.
+                */
+               rio_dprintk(RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum);
                PortP->State &= ~RIO_CLOSING;
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                if (PortP->firstOpen)
@@ -651,8 +635,8 @@ riotclose(void  *ptr)
                return -EIO;
        }
 
-       if ( p->RIOHalted ) {
-               RIOClearUp( PortP );
+       if (p->RIOHalted) {
+               RIOClearUp(PortP);
                goto close_end;
        }
 
@@ -665,57 +649,56 @@ riotclose(void  *ptr)
        }
 
        if (!deleted)
-         while (try && (PortP->PortState & PORT_ISOPEN)) {
-               try--;
-               if (time_after (jiffies, end_time)) {
-                 rio_dprintk (RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n" );
-                 RIOPreemptiveCmd(p, PortP,FCLOSE);
-                 break;
-               }
-               rio_dprintk (RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", 
-                                          PortP->PortState & PORT_ISOPEN);
+               while (try && (PortP->PortState & PORT_ISOPEN)) {
+                       try--;
+                       if (time_after(jiffies, end_time)) {
+                               rio_dprintk(RIO_DEBUG_TTY, "Run out of tries - force the bugger shut!\n");
+                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                               break;
+                       }
+                       rio_dprintk(RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", PortP->PortState & PORT_ISOPEN);
 
-               if ( p->RIOHalted ) {
-                       RIOClearUp( PortP );
-                       goto close_end;
-               }
-               if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
-                       rio_dprintk (RIO_DEBUG_TTY, "RTA EINTR in delay \n");
-                       RIOPreemptiveCmd(p, PortP,FCLOSE);
-                       break;
+                       if (p->RIOHalted) {
+                               RIOClearUp(PortP);
+                               goto close_end;
+                       }
+                       if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
+                               rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
+                               RIOPreemptiveCmd(p, PortP, FCLOSE);
+                               break;
+                       }
                }
-       }
        rio_spin_lock_irqsave(&PortP->portSem, flags);
-       rio_dprintk (RIO_DEBUG_TTY, "Close: try was %d on completion\n", try );
+       rio_dprintk(RIO_DEBUG_TTY, "Close: try was %d on completion\n", try);
+
        /* RIOPreemptiveCmd(p, PortP, FCLOSE); */
 
 /*
 ** 15.10.1998 ARG - ESIL 0761 part fix
 ** RIO has it's own CTSFLOW and RTSFLOW flags in 'Config' in the port structure,** we need to make sure that the flags are clear when the port is opened.
 */
-       PortP->Config &= ~(RIO_CTSFLOW|RIO_RTSFLOW);
+       PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW);
 
 #ifdef STATS
        PortP->Stat.CloseCnt++;
 #endif
        /*
-       ** Count opens for port statistics reporting
-       */
+        ** Count opens for port statistics reporting
+        */
        if (PortP->statsGather)
                PortP->closes++;
 
-close_end:
+      close_end:
        /* XXX: Why would a "DELETED" flag be reset here? I'd have
           thought that a "deleted" flag means that the port was
           permanently gone, but here we can make it reappear by it
           being in close during the "deletion".
-       */
-       PortP->State &= ~(RIO_CLOSING|RIO_DELETED);
+        */
+       PortP->State &= ~(RIO_CLOSING | RIO_DELETED);
        if (PortP->firstOpen)
                PortP->firstOpen--;
        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-       rio_dprintk (RIO_DEBUG_TTY, "Return from close\n");
+       rio_dprintk(RIO_DEBUG_TTY, "Return from close\n");
        return rv;
 }
 
@@ -728,52 +711,50 @@ close_end:
 ** COOK_MEDIUM if the card can do all the processing necessary.
 */
 #if 0
-static int
-RIOCookMode(struct ttystatics *tp)
+static int RIOCookMode(struct ttystatics *tp)
 {
        /*
-       ** We can't handle tm.c_mstate != 0 on SCO
-       ** We can't handle mapping
-       ** We can't handle non-ttwrite line disc.
-       ** We can't handle lflag XCASE
-       ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3)
-       */
+        ** We can't handle tm.c_mstate != 0 on SCO
+        ** We can't handle mapping
+        ** We can't handle non-ttwrite line disc.
+        ** We can't handle lflag XCASE
+        ** We can handle oflag OPOST & (OCRNL, ONLCR, TAB3)
+        */
 
 #ifdef CHECK
-       CheckTtyP( tp );
+       CheckTtyP(tp);
 #endif
        if (!(tp->tm.c_oflag & OPOST))  /* No post processing */
                return COOK_RAW;        /* Raw mode o/p */
 
-       if ( tp->tm.c_lflag & XCASE )
+       if (tp->tm.c_lflag & XCASE)
                return COOK_WELL;       /* Use line disc */
 
-       if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3 ) )
+       if (tp->tm.c_oflag & ~(OPOST | ONLCR | OCRNL | TAB3))
                return COOK_WELL;       /* Use line disc for strange modes */
 
-       if ( tp->tm.c_oflag == OPOST )  /* If only OPOST is set, do RAW */
+       if (tp->tm.c_oflag == OPOST)    /* If only OPOST is set, do RAW */
                return COOK_RAW;
 
        /*
-       ** So, we need to output process!
-       */
+        ** So, we need to output process!
+        */
        return COOK_MEDIUM;
 }
 #endif
 
-static void
-RIOClearUp(PortP)
+static void RIOClearUp(PortP)
 struct Port *PortP;
 {
-       rio_dprintk (RIO_DEBUG_TTY, "RIOHalted set\n");
-       PortP->Config = 0;        /* Direct semaphore */
+       rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n");
+       PortP->Config = 0;      /* Direct semaphore */
        PortP->PortState = 0;
        PortP->firstOpen = 0;
        PortP->FlushCmdBodge = 0;
        PortP->ModemState = PortP->CookMode = 0;
        PortP->Mapped = 0;
        PortP->WflushFlag = 0;
-       PortP->MagicFlags       = 0;
+       PortP->MagicFlags = 0;
        PortP->RxDataStart = 0;
        PortP->TxBufferIn = 0;
        PortP->TxBufferOut = 0;
@@ -788,33 +769,31 @@ struct Port *PortP;
 ** Other values of len aren't allowed, and will cause
 ** a panic.
 */
-int RIOShortCommand(struct rio_info *p, struct Port *PortP,
-               int command, int len, int arg)
+int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg)
 {
        PKT *PacketP;
-       int             retries = 20; /* at 10 per second -> 2 seconds */
+       int retries = 20;       /* at 10 per second -> 2 seconds */
        unsigned long flags;
 
-       rio_dprintk (RIO_DEBUG_TTY, "entering shortcommand.\n");
+       rio_dprintk(RIO_DEBUG_TTY, "entering shortcommand.\n");
 #ifdef CHECK
-       CheckPortP( PortP );
-       if ( len < 1 || len > 2 )
-               cprintf(("STUPID LENGTH %d\n",len));
+       CheckPortP(PortP);
+       if (len < 1 || len > 2)
+               cprintf(("STUPID LENGTH %d\n", len));
 #endif
 
-       if ( PortP->State & RIO_DELETED ) {
-               rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
+       if (PortP->State & RIO_DELETED) {
+               rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
                return RIO_FAIL;
        }
        rio_spin_lock_irqsave(&PortP->portSem, flags);
 
        /*
-       ** If the port is in use for pre-emptive command, then wait for it to 
-       ** be free again.
-       */
-       while ( (PortP->InUse != NOT_INUSE) && !p->RIOHalted ) {
-               rio_dprintk (RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", 
-                                          retries);
+        ** If the port is in use for pre-emptive command, then wait for it to
+        ** be free again.
+        */
+       while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted) {
+               rio_dprintk(RIO_DEBUG_TTY, "Waiting for not in use (%d)\n", retries);
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                if (retries-- <= 0) {
                        return RIO_FAIL;
@@ -824,47 +803,47 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP,
                }
                rio_spin_lock_irqsave(&PortP->portSem, flags);
        }
-       if ( PortP->State & RIO_DELETED ) {
-               rio_dprintk (RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
+       if (PortP->State & RIO_DELETED) {
+               rio_dprintk(RIO_DEBUG_TTY, "Short command to deleted RTA ignored\n");
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                return RIO_FAIL;
        }
 
-       while ( !can_add_transmit(&PacketP,PortP) && !p->RIOHalted ) {
-               rio_dprintk (RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries);
+       while (!can_add_transmit(&PacketP, PortP) && !p->RIOHalted) {
+               rio_dprintk(RIO_DEBUG_TTY, "Waiting to add short command to queue (%d)\n", retries);
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                if (retries-- <= 0) {
-                 rio_dprintk (RIO_DEBUG_TTY, "out of tries. Failing\n");
+                       rio_dprintk(RIO_DEBUG_TTY, "out of tries. Failing\n");
                        return RIO_FAIL;
                }
-               if ( RIODelay_ni(PortP, HUNDRED_MS)==RIO_FAIL ) {
+               if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) {
                        return RIO_FAIL;
                }
                rio_spin_lock_irqsave(&PortP->portSem, flags);
        }
 
-       if ( p->RIOHalted ) {
+       if (p->RIOHalted) {
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                return RIO_FAIL;
        }
 
        /*
-       ** set the command byte and the argument byte
-       */
-       WBYTE(PacketP->data[0] , command);
+        ** set the command byte and the argument byte
+        */
+       WBYTE(PacketP->data[0], command);
 
-       if ( len==2 )
-               WBYTE(PacketP->data[1] , arg);
+       if (len == 2)
+               WBYTE(PacketP->data[1], arg);
 
        /*
-       ** set the length of the packet and set the command bit.
-       */
-       WBYTE(PacketP->len , PKT_CMD_BIT | len);
+        ** set the length of the packet and set the command bit.
+        */
+       WBYTE(PacketP->len, PKT_CMD_BIT | len);
 
        add_transmit(PortP);
        /*
-       ** Count characters transmitted for port statistics reporting
-       */
+        ** Count characters transmitted for port statistics reporting
+        */
        if (PortP->statsGather)
                PortP->txchars += len;
 
@@ -878,28 +857,26 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP,
 ** This is an ioctl interface. This is the twentieth century. You know what
 ** its all about.
 */
-int
-riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
+int riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
 {
-       register struct         Port *PortP;
-       register struct         ttystatics *tp;
-       int                                     current;
-       int                                     ParamSemIncremented = 0;
-       int                                     old_oflag, old_cflag, old_iflag, changed, oldcook;
-       int                                     i;
-       unsigned char           sio_regs[5];            /* Here be magic */
-       short                           vpix_cflag;
-       short                           divisor;
-       int                                     baud;
-       uint                            SysPort = rio_minor(tty);
-       int                             Modem = rio_ismodem(tty);
-       int                                     ioctl_processed;
-
-       rio_dprintk (RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n",
-                       SysPort, cmd, arg, Modem?"Modem":"tty") ;
-
-       if ( SysPort >= RIO_PORTS ) {
-               rio_dprintk (RIO_DEBUG_TTY, "Bad port number %d\n", SysPort);
+       register struct Port *PortP;
+       register struct ttystatics *tp;
+       int current;
+       int ParamSemIncremented = 0;
+       int old_oflag, old_cflag, old_iflag, changed, oldcook;
+       int i;
+       unsigned char sio_regs[5];      /* Here be magic */
+       short vpix_cflag;
+       short divisor;
+       int baud;
+       uint SysPort = rio_minor(tty);
+       int Modem = rio_ismodem(tty);
+       int ioctl_processed;
+
+       rio_dprintk(RIO_DEBUG_TTY, "port ioctl SysPort %d command 0x%x argument 0x%x %s\n", SysPort, cmd, arg, Modem ? "Modem" : "tty");
+
+       if (SysPort >= RIO_PORTS) {
+               rio_dprintk(RIO_DEBUG_TTY, "Bad port number %d\n", SysPort);
                return -ENXIO;
        }
 
@@ -912,205 +889,195 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
        PortP->Stat.IoctlCnt++;
 #endif
 
-       if ( PortP->State & RIO_DELETED ) {
+       if (PortP->State & RIO_DELETED) {
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                return -EIO;
        }
 
 
-       if ( p->RIOHalted ) {
-               RIOClearUp( PortP );
+       if (p->RIOHalted) {
+               RIOClearUp(PortP);
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                return -EIO;
        }
 
        /*
-       ** Count ioctls for port statistics reporting
-       */
+        ** Count ioctls for port statistics reporting
+        */
        if (PortP->statsGather)
                PortP->ioctls++;
 
        /*
-       ** Specialix RIO Ioctl calls
-       */
+        ** Specialix RIO Ioctl calls
+        */
        switch (cmd) {
 
-               case TCRIOTRIAD:
-                       if ( arg )
-                               PortP->State |= RIO_TRIAD_MODE;
-                       else
-                               PortP->State &= ~RIO_TRIAD_MODE;
-                       /*
-                       ** Normally, when istrip is set on a port, a config is
-                       ** sent to the RTA instructing the CD1400 to do the
-                       ** stripping. In TRIAD mode, the interrupt receive routine
-                       ** must do the stripping instead, since it has to detect
-                       ** an 8 bit function key sequence. If istrip is set with
-                       ** TRIAD mode on(off), and 8 bit data is being read by
-                       ** the port, the user then turns TRIAD mode off(on), the RTA
-                       ** must be reconfigured (not) to do the stripping.
-                       ** Hence we call RIOParam here.
-                       */
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP);       
-                       return 0;
+       case TCRIOTRIAD:
+               if (arg)
+                       PortP->State |= RIO_TRIAD_MODE;
+               else
+                       PortP->State &= ~RIO_TRIAD_MODE;
+               /*
+                ** Normally, when istrip is set on a port, a config is
+                ** sent to the RTA instructing the CD1400 to do the
+                ** stripping. In TRIAD mode, the interrupt receive routine
+                ** must do the stripping instead, since it has to detect
+                ** an 8 bit function key sequence. If istrip is set with
+                ** TRIAD mode on(off), and 8 bit data is being read by
+                ** the port, the user then turns TRIAD mode off(on), the RTA
+                ** must be reconfigured (not) to do the stripping.
+                ** Hence we call RIOParam here.
+                */
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
+               return 0;
 
-               case TCRIOTSTATE:
-                       rio_dprintk (RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n",
-                               arg ? "en" : "dis");
-                       /* MonitorTstate = 0 ;*/
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
-                       return 0;
+       case TCRIOTSTATE:
+               rio_dprintk(RIO_DEBUG_TTY, "tbusy/tstop monitoring %sabled\n", arg ? "en" : "dis");
+               /* MonitorTstate = 0 ; */
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
+               return 0;
 
-               case TCRIOSTATE: /* current state of Modem input pins */
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE\n");
-                       if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL)
-                               rio_dprintk (RIO_DEBUG_TTY, "TCRIOSTATE command failed\n");
-                       PortP->State |= RIO_BUSY;
-                       current = PortP->ModemState;
-                       if ( copyout((caddr_t)&current, (int)arg,
-                                                       sizeof(current))==COPYFAIL ) {
-                               rio_dprintk (RIO_DEBUG_TTY, "Copyout failed\n");
-                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                               pseterr(EFAULT);
-                       }
+       case TCRIOSTATE:        /* current state of Modem input pins */
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE\n");
+               if (RIOPreemptiveCmd(p, PortP, MGET) == RIO_FAIL)
+                       rio_dprintk(RIO_DEBUG_TTY, "TCRIOSTATE command failed\n");
+               PortP->State |= RIO_BUSY;
+               current = PortP->ModemState;
+               if (copyout((caddr_t) & current, (int) arg, sizeof(current)) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_TTY, "Copyout failed\n");
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       return 0;
+                       pseterr(EFAULT);
+               }
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
 
-               case TCRIOMBIS:         /* Set modem lines */
-               case TCRIOMBIC:         /* Clear modem lines */
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n");
-                       if (cmd == TCRIOMBIS) {
-                               uint            state;
-                               state = (uint)arg;
-                               PortP->ModemState |= (ushort)state;
-                               PortP->ModemLines = (ulong) arg;
-                               if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL)
-                                       rio_dprintk (RIO_DEBUG_TTY, 
-                                        "TCRIOMBIS command failed\n");
-                       }
-                       else {
-                               uint            state;
-
-                               state = (uint)arg;
-                               PortP->ModemState &= ~(ushort)state;
-                               PortP->ModemLines = (ulong) arg;
-                               if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL)
-                                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOMBIC command failed\n");
-                       }
-                       PortP->State |= RIO_BUSY;
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       return 0;
+       case TCRIOMBIS: /* Set modem lines */
+       case TCRIOMBIC: /* Clear modem lines */
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS/TCRIOMBIC\n");
+               if (cmd == TCRIOMBIS) {
+                       uint state;
+                       state = (uint) arg;
+                       PortP->ModemState |= (ushort) state;
+                       PortP->ModemLines = (ulong) arg;
+                       if (RIOPreemptiveCmd(p, PortP, MBIS) == RIO_FAIL)
+                               rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIS command failed\n");
+               } else {
+                       uint state;
 
-               case TCRIOXPON: /* set Xprint ON string */
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPON\n");
-                       if ( copyin((int)arg, (caddr_t)PortP->Xprint.XpOn,
-                                               MAX_XP_CTRL_LEN)==COPYFAIL ) {
-                               rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n");
-                               PortP->Xprint.XpOn[0] = '\0';
-                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                               pseterr(EFAULT);
-                       }
-                       PortP->Xprint.XpOn[MAX_XP_CTRL_LEN-1] = '\0';
-                       PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+
-                                                                                               strlen(PortP->Xprint.XpOff);
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       return 0;
+                       state = (uint) arg;
+                       PortP->ModemState &= ~(ushort) state;
+                       PortP->ModemLines = (ulong) arg;
+                       if (RIOPreemptiveCmd(p, PortP, MBIC) == RIO_FAIL)
+                               rio_dprintk(RIO_DEBUG_TTY, "TCRIOMBIC command failed\n");
+               }
+               PortP->State |= RIO_BUSY;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
 
-               case TCRIOXPOFF: /* set Xprint OFF string */
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPOFF\n");
-                       if ( copyin( (int)arg, (caddr_t)PortP->Xprint.XpOff,
-                                               MAX_XP_CTRL_LEN)==COPYFAIL ) {
-                               rio_dprintk (RIO_DEBUG_TTY, "Copyin failed\n");
-                               PortP->Xprint.XpOff[0] = '\0';
-                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                               pseterr(EFAULT);
-                       }
-                       PortP->Xprint.XpOff[MAX_XP_CTRL_LEN-1] = '\0';
-                       PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn)+
-                                                                               strlen(PortP->Xprint.XpOff);
+       case TCRIOXPON: /* set Xprint ON string */
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPON\n");
+               if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOn, MAX_XP_CTRL_LEN) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
+                       PortP->Xprint.XpOn[0] = '\0';
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       return 0;
+                       pseterr(EFAULT);
+               }
+               PortP->Xprint.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
+               PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
 
-               case TCRIOXPCPS: /* set Xprint CPS string */
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPCPS\n");
-                       if ( (uint)arg > p->RIOConf.MaxXpCps || 
-                                       (uint)arg < p->RIOConf.MinXpCps ) {
-                               rio_dprintk (RIO_DEBUG_TTY, "%d CPS out of range\n",arg);
-                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                               pseterr(EINVAL);
-                               return 0;
-                       }
-                       PortP->Xprint.XpCps = (uint)arg;
+       case TCRIOXPOFF:        /* set Xprint OFF string */
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPOFF\n");
+               if (copyin((int) arg, (caddr_t) PortP->Xprint.XpOff, MAX_XP_CTRL_LEN) == COPYFAIL) {
+                       rio_dprintk(RIO_DEBUG_TTY, "Copyin failed\n");
+                       PortP->Xprint.XpOff[0] = '\0';
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       return 0;
+                       pseterr(EFAULT);
+               }
+               PortP->Xprint.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
+               PortP->Xprint.XpLen = strlen(PortP->Xprint.XpOn) + strlen(PortP->Xprint.XpOff);
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
 
-               case TCRIOXPRINT:
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOXPRINT\n");
-                       if ( copyout((caddr_t)&PortP->Xprint, (int)arg,
-                                       sizeof(struct Xprint))==COPYFAIL ) {
-                               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                               pseterr(EFAULT);
-                       }
+       case TCRIOXPCPS:        /* set Xprint CPS string */
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPCPS\n");
+               if ((uint) arg > p->RIOConf.MaxXpCps || (uint) arg < p->RIOConf.MinXpCps) {
+                       rio_dprintk(RIO_DEBUG_TTY, "%d CPS out of range\n", arg);
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+                       pseterr(EINVAL);
                        return 0;
+               }
+               PortP->Xprint.XpCps = (uint) arg;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
 
-               case TCRIOIXANYON:
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYON\n");
-                       PortP->Config |= RIO_IXANY;
+       case TCRIOXPRINT:
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOXPRINT\n");
+               if (copyout((caddr_t) & PortP->Xprint, (int) arg, sizeof(struct Xprint)) == COPYFAIL) {
                        rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       return 0;
+                       pseterr(EFAULT);
+               }
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
 
-               case TCRIOIXANYOFF:
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXANYOFF\n");
-                       PortP->Config &= ~RIO_IXANY;
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       return 0;
+       case TCRIOIXANYON:
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYON\n");
+               PortP->Config |= RIO_IXANY;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
 
-               case TCRIOIXONON:
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONON\n");
-                       PortP->Config |= RIO_IXON;
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       return 0;
+       case TCRIOIXANYOFF:
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXANYOFF\n");
+               PortP->Config &= ~RIO_IXANY;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
 
-               case TCRIOIXONOFF:
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOIXONOFF\n");
-                       PortP->Config &= ~RIO_IXON;
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       return 0;
+       case TCRIOIXONON:
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONON\n");
+               PortP->Config |= RIO_IXON;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
+
+       case TCRIOIXONOFF:
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOIXONOFF\n");
+               PortP->Config &= ~RIO_IXON;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               return 0;
 
 /*
 ** 15.10.1998 ARG - ESIL 0761 part fix
 ** Added support for CTS and RTS flow control ioctls :
 */
-               case TCRIOCTSFLOWEN:
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n");
-                       PortP->Config |= RIO_CTSFLOW;
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP);       
-                       return 0;
+       case TCRIOCTSFLOWEN:
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWEN\n");
+               PortP->Config |= RIO_CTSFLOW;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
+               return 0;
 
-               case TCRIOCTSFLOWDIS:
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n");
-                       PortP->Config &= ~RIO_CTSFLOW;
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP);       
-                       return 0;
+       case TCRIOCTSFLOWDIS:
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIOCTSFLOWDIS\n");
+               PortP->Config &= ~RIO_CTSFLOW;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
+               return 0;
 
-               case TCRIORTSFLOWEN:
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n");
-                       PortP->Config |= RIO_RTSFLOW;
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP);       
-                       return 0;
+       case TCRIORTSFLOWEN:
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWEN\n");
+               PortP->Config |= RIO_RTSFLOW;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
+               return 0;
 
-               case TCRIORTSFLOWDIS:
-                       rio_dprintk (RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n");
-                       PortP->Config &= ~RIO_RTSFLOW;
-                       rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-                       RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP);       
-                       return 0;
+       case TCRIORTSFLOWDIS:
+               rio_dprintk(RIO_DEBUG_TTY, "TCRIORTSFLOWDIS\n");
+               PortP->Config &= ~RIO_RTSFLOW;
+               rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+               RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
+               return 0;
 
 /* end ESIL 0761 part fix */
 
@@ -1119,35 +1086,35 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
 
        /* Lynx IOCTLS */
        switch (cmd) {
-               case TIOCSETP:
-               case TIOCSETN:
-               case OTIOCSETP:
-               case OTIOCSETN:
-                       ioctl_processed++;
-                       ttyseth(PortP, tp, (struct old_sgttyb *)arg);
-                       break;
-               case TCSETA:
-               case TCSETAW:
-               case TCSETAF:
-                       ioctl_processed++;
-                       rio_dprintk (RIO_DEBUG_TTY, "NON POSIX ioctl\n");
-                       ttyseth_pv(PortP, tp, (struct termios *)arg, 0);
-                       break;
-               case TCSETAP:   /* posix tcsetattr() */
-               case TCSETAWP:  /* posix tcsetattr() */
-               case TCSETAFP:  /* posix tcsetattr() */
-                       rio_dprintk (RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n");
-                       ttyseth_pv(PortP, tp, (struct termios *)arg, 1);
-                       ioctl_processed++;
-                       break;
+       case TIOCSETP:
+       case TIOCSETN:
+       case OTIOCSETP:
+       case OTIOCSETN:
+               ioctl_processed++;
+               ttyseth(PortP, tp, (struct old_sgttyb *) arg);
+               break;
+       case TCSETA:
+       case TCSETAW:
+       case TCSETAF:
+               ioctl_processed++;
+               rio_dprintk(RIO_DEBUG_TTY, "NON POSIX ioctl\n");
+               ttyseth_pv(PortP, tp, (struct termios *) arg, 0);
+               break;
+       case TCSETAP:           /* posix tcsetattr() */
+       case TCSETAWP:          /* posix tcsetattr() */
+       case TCSETAFP:          /* posix tcsetattr() */
+               rio_dprintk(RIO_DEBUG_TTY, "NON POSIX SYSV ioctl\n");
+               ttyseth_pv(PortP, tp, (struct termios *) arg, 1);
+               ioctl_processed++;
+               break;
        }
 
        /*
-       ** If its any of the commands that require the port to be in the
-       ** non-busy state wait until all output has drained 
-       */
+        ** If its any of the commands that require the port to be in the
+        ** non-busy state wait until all output has drained
+        */
        if (!ioctl_processed)
-       switch(cmd) {
+               switch (cmd) {
                case TCSETAW:
                case TCSETAF:
                case TCSETA:
@@ -1171,29 +1138,29 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
 #endif
                case TIOCSETD:
                case TIOCSETN:
-                       rio_dprintk (RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n");
+                       rio_dprintk(RIO_DEBUG_TTY, "wait for non-BUSY, semaphore set\n");
                        /*
-                       ** Wait for drain here, at least as far as the double buffer
-                       ** being empty.
-                       */
+                        ** Wait for drain here, at least as far as the double buffer
+                        ** being empty.
+                        */
                        /* XXX Does the above comment mean that this has
                           still to be implemented? -- REW */
                        /* XXX Is the locking OK together with locking
-                           in txenable? (Deadlock?) -- REW */
-                       
-                       RIOTxEnable((char *)PortP);
+                          in txenable? (Deadlock?) -- REW */
+
+                       RIOTxEnable((char *) PortP);
                        break;
                default:
                        break;
-       }
+               }
 
        old_cflag = tp->tm.c_cflag;
        old_iflag = tp->tm.c_iflag;
        old_oflag = tp->tm.c_oflag;
        oldcook = PortP->CookMode;
 
-       if ( p->RIOHalted ) {
-               RIOClearUp( PortP );
+       if (p->RIOHalted) {
+               RIOClearUp(PortP);
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                pseterr(EIO);
                return 0;
@@ -1202,10 +1169,10 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
        PortP->FlushCmdBodge = 0;
 
        /*
-       ** If the port is locked, and it is reconfigured, we want
-       ** to restore the state of the tty structure so the change is NOT
-       ** made.
-       */
+        ** If the port is locked, and it is reconfigured, we want
+        ** to restore the state of the tty structure so the change is NOT
+        ** made.
+        */
        if (PortP->Lock) {
                tp->tm.c_iflag = PortP->StoredTty.iflag;
                tp->tm.c_oflag = PortP->StoredTty.oflag;
@@ -1214,13 +1181,12 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
                tp->tm.c_line = PortP->StoredTty.line;
                for (i = 0; i < NCC + 1; i++)
                        tp->tm.c_cc[i] = PortP->StoredTty.cc[i];
-       }
-       else {
+       } else {
                /*
-               ** If the port is set to store the parameters, and it is
-               ** reconfigured, we want to save the current tty struct so it
-               ** may be restored on the next open.
-               */
+                ** If the port is set to store the parameters, and it is
+                ** reconfigured, we want to save the current tty struct so it
+                ** may be restored on the next open.
+                */
                if (PortP->Store) {
                        PortP->StoredTty.iflag = tp->tm.c_iflag;
                        PortP->StoredTty.oflag = tp->tm.c_oflag;
@@ -1232,44 +1198,41 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
                }
        }
 
-       changed = (tp->tm.c_cflag != old_cflag) ||
-                               (tp->tm.c_iflag != old_iflag) ||
-                               (tp->tm.c_oflag != old_oflag);
+       changed = (tp->tm.c_cflag != old_cflag) || (tp->tm.c_iflag != old_iflag) || (tp->tm.c_oflag != old_oflag);
 
        PortP->CookMode = RIOCookMode(tp);      /* Set new cooking mode */
 
-       rio_dprintk (RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n",
-                       changed,PortP->CookMode,oldcook);
+       rio_dprintk(RIO_DEBUG_TTY, "RIOIoctl changed %d newcook %d oldcook %d\n", changed, PortP->CookMode, oldcook);
 
 #ifdef MODEM_SUPPORT
        /*
-       ** kludge to force CARR_ON if CLOCAL set
-       */
-       if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD))        {
+        ** kludge to force CARR_ON if CLOCAL set
+        */
+       if ((tp->tm.c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) {
                tp->tm.c_state |= CARR_ON;
-               wakeup ((caddr_t)&tp->tm.c_canq);
+               wakeup((caddr_t) & tp->tm.c_canq);
        }
 #endif
 
-       if ( p->RIOHalted ) {
-               RIOClearUp( PortP );
+       if (p->RIOHalted) {
+               RIOClearUp(PortP);
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
                pseterr(EIO);
                return 0;
        }
        /*
-       ** Re-configure if modes or cooking have changed
-       */
+        ** Re-configure if modes or cooking have changed
+        */
        if (changed || oldcook != PortP->CookMode || (ioctl_processed)) {
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-               rio_dprintk (RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n");
-               RIOParam(PortP,CONFIG,Modem,OK_TO_SLEEP);       
+               rio_dprintk(RIO_DEBUG_TTY, "Ioctl changing the PORT settings\n");
+               RIOParam(PortP, CONFIG, Modem, OK_TO_SLEEP);
                rio_spin_lock_irqsave(&PortP->portSem, flags);
        }
 
        if (p->RIOHalted) {
                rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-               RIOClearUp( PortP );
+               RIOClearUp(PortP);
                pseterr(EIO);
                return 0;
        }
@@ -1280,36 +1243,32 @@ riotioctl(struct rio_info *p, struct tty_struct *tty, int cmd, caddr_t arg)
 /*
        ttyseth -- set hardware dependent tty settings
 */
-void
-ttyseth(PortP, s, sg)
-struct Port *          PortP;
-struct ttystatics *            s;
+void ttyseth(PortP, s, sg)
+struct Port *PortP;
+struct ttystatics *s;
 struct old_sgttyb *sg;
 {
-       struct old_sgttyb *     tsg;
+       struct old_sgttyb *tsg;
        struct termios *tp = &s->tm;
 
        tsg = &s->sg;
 
-       if (sg->sg_flags & (EVENP|ODDP))  {
+       if (sg->sg_flags & (EVENP | ODDP)) {
                tp->c_cflag &= PARENB;
                if (sg->sg_flags & EVENP) {
                        if (sg->sg_flags & ODDP) {
                                tp->c_cflag &= V_CS7;
                                tp->c_cflag &= ~PARENB;
-                       }
-                       else {
+                       } else {
                                tp->c_cflag &= V_CS7;
                                tp->c_cflag &= PARENB;
                                tp->c_cflag &= PARODD;
                        }
-               }
-               else if (sg->sg_flags & ODDP) {
+               } else if (sg->sg_flags & ODDP) {
                        tp->c_cflag &= V_CS7;
                        tp->c_cflag &= PARENB;
                        tp->c_cflag &= PARODD;
-               }
-               else {
+               } else {
                        tp->c_cflag &= V_CS7;
                        tp->c_cflag &= PARENB;
                }
@@ -1320,16 +1279,16 @@ struct old_sgttyb *sg;
  * I will have to use separate sets of flags to store them in the 
  * Port structure.
  */
-       if ( !sg->sg_ospeed )
+       if (!sg->sg_ospeed)
                sg->sg_ospeed = sg->sg_ispeed;
        else
                sg->sg_ispeed = sg->sg_ospeed;
-       if (sg->sg_ispeed > V_EXTB ) 
+       if (sg->sg_ispeed > V_EXTB)
                sg->sg_ispeed = V_EXTB;
        if (sg->sg_ispeed < V_B0)
                sg->sg_ispeed = V_B0;
        *tsg = *sg;
-   tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int)sg->sg_ispeed];
+       tp->c_cflag = (tp->c_cflag & ~V_CBAUD) | conv_bv[(int) sg->sg_ispeed];
 }
 
 /*
@@ -1338,36 +1297,33 @@ struct old_sgttyb *sg;
                                sysv = 0 => (POSIX):     struct termios *sg
                                sysv != 0 => (System V): struct termio *sg
 */
-static void
-ttyseth_pv(PortP, s, sg, sysv)
+static void ttyseth_pv(PortP, s, sg, sysv)
 struct Port *PortP;
 struct ttystatics *s;
 struct termios *sg;
 int sysv;
 {
-    int speed;
-    unsigned char csize;
-    unsigned char cread;
-    unsigned int lcr_flags;
-    int ps;
-    if (sysv) {
-        /* sg points to a System V termio structure */
-        csize = ((struct termio *)sg)->c_cflag & CSIZE;
-        cread = ((struct termio *)sg)->c_cflag & CREAD;
-        speed = conv_vb[((struct termio *)sg)->c_cflag & V_CBAUD];
-    }
-    else {
-        /* sg points to a POSIX termios structure */
-        csize = sg->c_cflag & CSIZE;
-        cread = sg->c_cflag & CREAD;
-        speed = conv_vb[sg->c_cflag & V_CBAUD];
-    }
-    if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) {
-        s->sg.sg_ispeed = speed;
-        s->sg.sg_ospeed = speed;
-        s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) |
-                         conv_bv[(int)s->sg.sg_ispeed];
-    }
+       int speed;
+       unsigned char csize;
+       unsigned char cread;
+       unsigned int lcr_flags;
+       int ps;
+
+       if (sysv) {
+               /* sg points to a System V termio structure */
+               csize = ((struct termio *) sg)->c_cflag & CSIZE;
+               cread = ((struct termio *) sg)->c_cflag & CREAD;
+               speed = conv_vb[((struct termio *) sg)->c_cflag & V_CBAUD];
+       } else {
+               /* sg points to a POSIX termios structure */
+               csize = sg->c_cflag & CSIZE;
+               cread = sg->c_cflag & CREAD;
+               speed = conv_vb[sg->c_cflag & V_CBAUD];
+       }
+       if (s->sg.sg_ispeed != speed || s->sg.sg_ospeed != speed) {
+               s->sg.sg_ispeed = speed;
+               s->sg.sg_ospeed = speed;
+               s->tm.c_cflag = (s->tm.c_cflag & ~V_CBAUD) | conv_bv[(int) s->sg.sg_ispeed];
+       }
 }
 #endif
index 1c7c42c638f0894a6c68afa40d7bfa7261278e0a..9b67e2468becd51a280d4c3637d656c56b8f991c 100644 (file)
@@ -89,47 +89,46 @@ typedef RIO_POINTER u_short_ptr;
 typedef RIO_POINTER ushort_ptr;
 #endif
 
-#else /* not INKERNEL */
-typedef unsigned char   BYTE;
-typedef unsigned short  WORD;
-typedef unsigned long   DWORD;
-typedef short           NUMBER;
-typedef short           *NUMBER_ptr;
-typedef unsigned short  *WORD_ptr;
-typedef unsigned char   *BYTE_ptr;
-typedef unsigned char   uchar ;
-typedef unsigned short  ushort ;
-typedef unsigned int    uint ;
-typedef unsigned long   ulong ;
-typedef unsigned char   u_char ;
-typedef unsigned short  u_short ;
-typedef unsigned int    u_int ;
-typedef unsigned long   u_long ;
-typedef unsigned short  ERROR ;
-typedef unsigned long ID ;
-typedef char             *char_ptr;
-typedef Channel          *Channel_ptr;
+#else                          /* not INKERNEL */
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef unsigned long DWORD;
+typedef short NUMBER;
+typedef short *NUMBER_ptr;
+typedef unsigned short *WORD_ptr;
+typedef unsigned char *BYTE_ptr;
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+typedef unsigned int uint;
+typedef unsigned long ulong;
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned int u_int;
+typedef unsigned long u_long;
+typedef unsigned short ERROR;
+typedef unsigned long ID;
+typedef char *char_ptr;
+typedef Channel *Channel_ptr;
 typedef struct FREE_LIST *FREE_LIST_ptr;
 typedef struct FREE_LIST **FREE_LIST_ptr_ptr;
-typedef struct LPB       *LPB_ptr;
-typedef struct Process   *Process_ptr;
-typedef struct PHB       *PHB_ptr;
-typedef struct PKT       *PKT_ptr;
-typedef struct PKT       **PKT_ptr_ptr;
-typedef struct Q_BUF     *Q_BUF_ptr;
-typedef struct Q_BUF     **Q_BUF_ptr_ptr;
+typedef struct LPB *LPB_ptr;
+typedef struct Process *Process_ptr;
+typedef struct PHB *PHB_ptr;
+typedef struct PKT *PKT_ptr;
+typedef struct PKT **PKT_ptr_ptr;
+typedef struct Q_BUF *Q_BUF_ptr;
+typedef struct Q_BUF **Q_BUF_ptr_ptr;
 typedef struct ROUTE_STR *ROUTE_STR_ptr;
-typedef struct RUP       *RUP_ptr;
-typedef short            *short_ptr;
-typedef u_short          *u_short_ptr;
-typedef ushort           *ushort_ptr;
-typedef struct PKT      PKT;
-typedef struct LPB      LPB;
-typedef struct RUP      RUP;
+typedef struct RUP *RUP_ptr;
+typedef short *short_ptr;
+typedef u_short *u_short_ptr;
+typedef ushort *ushort_ptr;
+typedef struct PKT PKT;
+typedef struct LPB LPB;
+typedef struct RUP RUP;
 #endif
 
 
-#endif /* __riotypes__ */
+#endif                         /* __riotypes__ */
 
 /*********** end of file ***********/
-
index 18a4f147edc22c3d1ea31c8467b2a06b132dbb02..f802d7593b806eea6cc6d141e9427214d9753819 100644 (file)
@@ -40,7 +40,7 @@
 
 */
 
-#ifndef        _riowinif_h                             /* If RIOWINDIF.H not already defined */
+#ifndef        _riowinif_h             /* If RIOWINDIF.H not already defined */
 #define        _riowinif_h    1
 
 /*****************************************************************************
 /* The PARM_MAP structure defines global values relating to the Host Card / RTA
    and is the main structure from which all other structures are referenced. */
 
-typedef        struct  _PARM_MAP
-{
-       _u16    phb_ptr;                /* 0x00 Pointer to the PHB array */
-       _u16    phb_num_ptr;            /* 0x02 Ptr to Number of PHB's */
-       _u16    free_list;              /* 0x04 Free List pointer */
-       _u16    free_list_end;          /* 0x06 Free List End pointer */
-       _u16    q_free_list_ptr;        /* 0x08 Ptr to Q_BUF variable */
-       _u16    unit_id_ptr;            /* 0x0A Unit Id */
-       _u16    link_str_ptr;           /* 0x0C Link Structure Array */
-       _u16    bootloader_1;           /* 0x0E 1st Stage Boot Loader */
-       _u16    bootloader_2;           /* 0x10 2nd Stage Boot Loader */
-       _u16    port_route_map_ptr;     /* 0x12 Port Route Map */
-       _u16    route_ptr;              /* 0x14 Route Map */
-       _u16    map_present;            /* 0x16 Route Map present */
-       _u16    pkt_num;                /* 0x18 Total number of packets */
-       _u16    q_num;                  /* 0x1A Total number of Q packets */
-       _u16    buffers_per_port;       /* 0x1C Number of buffers per port */
-       _u16    heap_size;              /* 0x1E Initial size of heap */
-       _u16    heap_left;              /* 0x20 Current Heap left */
-       _u16    error;                  /* 0x22 Error code */
-       _u16    tx_max;                 /* 0x24 Max number of tx pkts per phb */
-       _u16    rx_max;                 /* 0x26 Max number of rx pkts per phb */
-       _u16    rx_limit;               /* 0x28 For high / low watermarks */
-       _u16    links;                  /* 0x2A Links to use */
-       _u16    timer;                  /* 0x2C Interrupts per second */
-       _u16    rups;                   /* 0x2E Pointer to the RUPs */
-       _u16    max_phb;                /* 0x30 Mostly for debugging */
-       _u16    living;                 /* 0x32 Just increments!! */
-       _u16    init_done;              /* 0x34 Initialisation over */
-       _u16    booting_link;           /* 0x36 */
-       _u16    idle_count;             /* 0x38 Idle time counter */
-       _u16    busy_count;             /* 0x3A Busy counter */
-       _u16    idle_control;           /* 0x3C Control Idle Process */
-       _u16    tx_intr;                /* 0x3E TX interrupt pending */
-       _u16    rx_intr;                /* 0x40 RX interrupt pending */
-       _u16    rup_intr;               /* 0x42 RUP interrupt pending */
+typedef struct _PARM_MAP {
+       _u16 phb_ptr;           /* 0x00 Pointer to the PHB array */
+       _u16 phb_num_ptr;       /* 0x02 Ptr to Number of PHB's */
+       _u16 free_list;         /* 0x04 Free List pointer */
+       _u16 free_list_end;     /* 0x06 Free List End pointer */
+       _u16 q_free_list_ptr;   /* 0x08 Ptr to Q_BUF variable */
+       _u16 unit_id_ptr;       /* 0x0A Unit Id */
+       _u16 link_str_ptr;      /* 0x0C Link Structure Array */
+       _u16 bootloader_1;      /* 0x0E 1st Stage Boot Loader */
+       _u16 bootloader_2;      /* 0x10 2nd Stage Boot Loader */
+       _u16 port_route_map_ptr;        /* 0x12 Port Route Map */
+       _u16 route_ptr;         /* 0x14 Route Map */
+       _u16 map_present;       /* 0x16 Route Map present */
+       _u16 pkt_num;           /* 0x18 Total number of packets */
+       _u16 q_num;             /* 0x1A Total number of Q packets */
+       _u16 buffers_per_port;  /* 0x1C Number of buffers per port */
+       _u16 heap_size;         /* 0x1E Initial size of heap */
+       _u16 heap_left;         /* 0x20 Current Heap left */
+       _u16 error;             /* 0x22 Error code */
+       _u16 tx_max;            /* 0x24 Max number of tx pkts per phb */
+       _u16 rx_max;            /* 0x26 Max number of rx pkts per phb */
+       _u16 rx_limit;          /* 0x28 For high / low watermarks */
+       _u16 links;             /* 0x2A Links to use */
+       _u16 timer;             /* 0x2C Interrupts per second */
+       _u16 rups;              /* 0x2E Pointer to the RUPs */
+       _u16 max_phb;           /* 0x30 Mostly for debugging */
+       _u16 living;            /* 0x32 Just increments!! */
+       _u16 init_done;         /* 0x34 Initialisation over */
+       _u16 booting_link;      /* 0x36 */
+       _u16 idle_count;        /* 0x38 Idle time counter */
+       _u16 busy_count;        /* 0x3A Busy counter */
+       _u16 idle_control;      /* 0x3C Control Idle Process */
+       _u16 tx_intr;           /* 0x3E TX interrupt pending */
+       _u16 rx_intr;           /* 0x40 RX interrupt pending */
+       _u16 rup_intr;          /* 0x42 RUP interrupt pending */
 
 } PARM_MAP;
 
@@ -184,45 +183,44 @@ typedef   struct  _PARM_MAP
    attached to the system and there is normally an array of MAX_RUPS (=16) structures
    in a host card, defined by PARM_MAP->rup. */
 
-typedef        struct  _RUP
-{
-       _u16            txpkt;                  /* 0x00 Outgoing packet */
-       _u16            rxpkt;                  /* 0x02 ncoming packet */
-       _u16            link;                   /* 0x04 Which link to send packet down ? */
-       _u8             rup_dest_unit[2];       /* 0x06 Destination Unit */
-       _u16            handshake;              /* 0x08 Handshaking */
-       _u16            timeout;                /* 0x0A Timeout */
-       _u16            status;                 /* 0x0C Status */
-       _u16            txcontrol;              /* 0x0E Transmit control */
-       _u16            rxcontrol;              /* 0x10 Receive control */
+typedef struct _RUP {
+       _u16 txpkt;             /* 0x00 Outgoing packet */
+       _u16 rxpkt;             /* 0x02 ncoming packet */
+       _u16 link;              /* 0x04 Which link to send packet down ? */
+       _u8 rup_dest_unit[2];   /* 0x06 Destination Unit */
+       _u16 handshake;         /* 0x08 Handshaking */
+       _u16 timeout;           /* 0x0A Timeout */
+       _u16 status;            /* 0x0C Status */
+       _u16 txcontrol;         /* 0x0E Transmit control */
+       _u16 rxcontrol;         /* 0x10 Receive control */
 
 } RUP;
 
 /* Same thing again, but defined as offsets... */
 
-#define        RUP_txpkt               0x00            /* 0x00 Outgoing packet */
-#define        RUP_rxpkt               0x02            /* 0x02 Incoming packet */
-#define        RUP_link                0x04            /* 0x04 Which link to send packet down ? */
-#define        RUP_rup_dest_unit       0x06            /* 0x06 Destination Unit */
-#define        RUP_handshake           0x08            /* 0x08 Handshaking */
-#define        RUP_timeout             0x0A            /* 0x0A Timeout */
-#define        RUP_status              0x0C            /* 0x0C Status */
-#define        RUP_txcontrol           0x0E            /* 0x0E Transmit control */
-#define        RUP_rxcontrol           0x10            /* 0x10 Receive control */
-#define        sizeof_RUP              0x12            /* structure size = 0x12 */
+#define        RUP_txpkt               0x00    /* 0x00 Outgoing packet */
+#define        RUP_rxpkt               0x02    /* 0x02 Incoming packet */
+#define        RUP_link                0x04    /* 0x04 Which link to send packet down ? */
+#define        RUP_rup_dest_unit       0x06    /* 0x06 Destination Unit */
+#define        RUP_handshake           0x08    /* 0x08 Handshaking */
+#define        RUP_timeout             0x0A    /* 0x0A Timeout */
+#define        RUP_status              0x0C    /* 0x0C Status */
+#define        RUP_txcontrol           0x0E    /* 0x0E Transmit control */
+#define        RUP_rxcontrol           0x10    /* 0x10 Receive control */
+#define        sizeof_RUP              0x12    /* structure size = 0x12 */
 
 #define MAX_RUP                        16
 
 /* RUP.txcontrol definitions... */
-#define        TX_RUP_INACTIVE         0               /* Nothing to transmit */
-#define        TX_PACKET_READY         1               /* Transmit packet ready */
-#define        TX_LOCK_RUP             2               /* Transmit side locked */
+#define        TX_RUP_INACTIVE         0       /* Nothing to transmit */
+#define        TX_PACKET_READY         1       /* Transmit packet ready */
+#define        TX_LOCK_RUP             2       /* Transmit side locked */
 
 /* RUP.txcontrol definitions... */
-#define        RX_RUP_INACTIVE         0               /* Nothing received */
-#define        RX_PACKET_READY         1               /* Packet received */
+#define        RX_RUP_INACTIVE         0       /* Nothing received */
+#define        RX_PACKET_READY         1       /* Packet received */
 
-#define        RUP_NO_OWNER            0xFF            /* RUP not owned by any process */
+#define        RUP_NO_OWNER            0xFF    /* RUP not owned by any process */
 
 /*****************************************************************************
 **********************************         ***********************************
@@ -234,52 +232,51 @@ typedef   struct  _RUP
    to the system and there is normally an array of MAX_PHBS (=128) structures
    in a host card, defined by PARM_MAP->phb_ptr and PARM_MAP->phb_num_ptr. */
 
-typedef        struct  _PHB
-{
-       _u16            source;                 /* 0x00 Location of the PHB in the host card */
-       _u16            handshake;              /* 0x02 Used to manage receive packet flow control */
-       _u16            status;                 /* 0x04 Internal port transmit/receive status */
-       _u16            timeout;                /* 0x06 Time period to wait for an ACK */
-       _u16            link;                   /* 0x08 The host link associated with the PHB */
-       _u16            destination;            /* 0x0A Location of the remote port on the network */
-
-       _u16            tx_start;               /* 0x0C first entry in the packet array for transmit packets */
-       _u16            tx_end;                 /* 0x0E last entry in the packet array for transmit packets */
-       _u16            tx_add;                 /* 0x10 position in the packet array for new transmit packets */
-       _u16            tx_remove;              /* 0x12 current position in the packet pointer array */
-
-       _u16            rx_start;               /* 0x14 first entry in the packet array for receive packets */
-       _u16            rx_end;                 /* 0x16 last entry in the packet array for receive packets */
-       _u16            rx_add;                 /* 0x18 position in the packet array for new receive packets */
-       _u16            rx_remove;              /* 0x1A current position in the packet pointer array */
+typedef struct _PHB {
+       _u16 source;            /* 0x00 Location of the PHB in the host card */
+       _u16 handshake;         /* 0x02 Used to manage receive packet flow control */
+       _u16 status;            /* 0x04 Internal port transmit/receive status */
+       _u16 timeout;           /* 0x06 Time period to wait for an ACK */
+       _u16 link;              /* 0x08 The host link associated with the PHB */
+       _u16 destination;       /* 0x0A Location of the remote port on the network */
+
+       _u16 tx_start;          /* 0x0C first entry in the packet array for transmit packets */
+       _u16 tx_end;            /* 0x0E last entry in the packet array for transmit packets */
+       _u16 tx_add;            /* 0x10 position in the packet array for new transmit packets */
+       _u16 tx_remove;         /* 0x12 current position in the packet pointer array */
+
+       _u16 rx_start;          /* 0x14 first entry in the packet array for receive packets */
+       _u16 rx_end;            /* 0x16 last entry in the packet array for receive packets */
+       _u16 rx_add;            /* 0x18 position in the packet array for new receive packets */
+       _u16 rx_remove;         /* 0x1A current position in the packet pointer array */
 
 } PHB;
 
 /* Same thing again, but defined as offsets... */
 
-#define        PHB_source              0x00            /* 0x00 Location of the PHB in the host card */
-#define        PHB_handshake           0x02            /* 0x02 Used to manage receive packet flow control */
-#define        PHB_status              0x04            /* 0x04 Internal port transmit/receive status */
-#define        PHB_timeout             0x06            /* 0x06 Time period to wait for an ACK */
-#define        PHB_link                0x08            /* 0x08 The host link associated with the PHB */
-#define        PHB_destination         0x0A            /* 0x0A Location of the remote port on the network */
-#define        PHB_tx_start            0x0C            /* 0x0C first entry in the packet array for transmit packets */
-#define        PHB_tx_end              0x0E            /* 0x0E last entry in the packet array for transmit packets */
-#define        PHB_tx_add              0x10            /* 0x10 position in the packet array for new transmit packets */
-#define        PHB_tx_remove           0x12            /* 0x12 current position in the packet pointer array */
-#define        PHB_rx_start            0x14            /* 0x14 first entry in the packet array for receive packets */
-#define        PHB_rx_end              0x16            /* 0x16 last entry in the packet array for receive packets */
-#define        PHB_rx_add              0x18            /* 0x18 position in the packet array for new receive packets */
-#define        PHB_rx_remove           0x1A            /* 0x1A current position in the packet pointer array */
-#define        sizeof_PHB              0x1C            /* structure size = 0x1C */
+#define        PHB_source              0x00    /* 0x00 Location of the PHB in the host card */
+#define        PHB_handshake           0x02    /* 0x02 Used to manage receive packet flow control */
+#define        PHB_status              0x04    /* 0x04 Internal port transmit/receive status */
+#define        PHB_timeout             0x06    /* 0x06 Time period to wait for an ACK */
+#define        PHB_link                0x08    /* 0x08 The host link associated with the PHB */
+#define        PHB_destination         0x0A    /* 0x0A Location of the remote port on the network */
+#define        PHB_tx_start            0x0C    /* 0x0C first entry in the packet array for transmit packets */
+#define        PHB_tx_end              0x0E    /* 0x0E last entry in the packet array for transmit packets */
+#define        PHB_tx_add              0x10    /* 0x10 position in the packet array for new transmit packets */
+#define        PHB_tx_remove           0x12    /* 0x12 current position in the packet pointer array */
+#define        PHB_rx_start            0x14    /* 0x14 first entry in the packet array for receive packets */
+#define        PHB_rx_end              0x16    /* 0x16 last entry in the packet array for receive packets */
+#define        PHB_rx_add              0x18    /* 0x18 position in the packet array for new receive packets */
+#define        PHB_rx_remove           0x1A    /* 0x1A current position in the packet pointer array */
+#define        sizeof_PHB              0x1C    /* structure size = 0x1C */
 
 /* PHB.handshake definitions... */
-#define        PHB_HANDSHAKE_SET       0x0001          /* Set by LRT */
-#define        PHB_HANDSHAKE_RESET     0x0002          /* Set by ISR / driver */
+#define        PHB_HANDSHAKE_SET       0x0001  /* Set by LRT */
+#define        PHB_HANDSHAKE_RESET     0x0002  /* Set by ISR / driver */
 #define        PHB_HANDSHAKE_FLAGS     (PHB_HANDSHAKE_RESET|PHB_HANDSHAKE_SET)
                                                /* Reset by ltt */
 
-#define        MAX_PHB                 128             /* range 0-127 */
+#define        MAX_PHB                 128     /* range 0-127 */
 
 /*****************************************************************************
 **********************************         ***********************************
@@ -291,86 +288,85 @@ typedef   struct  _PHB
    and there is normally an array of MAX_LINKS (=4) structures in a host card,
    defined by PARM_MAP->link_str_ptr. */
 
-typedef        struct  _LPB
-{
-       _u16            link_number;            /* 0x00 Link Number */
-       _u16            in_ch;                  /* 0x02 Link In Channel */
-       _u16            out_ch;                 /* 0x04 Link Out Channel */
-       _u8             attached_serial[4];     /* 0x06 Attached serial number */
-       _u8             attached_host_serial[4];/* 0x0A Serial number of Host who booted other end */
-       _u16            descheduled;            /* 0x0E Currently Descheduled */
-       _u16            state;                  /* 0x10 Current state */
-       _u16            send_poll;              /* 0x12 Send a Poll Packet */
-       _u16            ltt_p;                  /* 0x14 Process Descriptor */
-       _u16            lrt_p;                  /* 0x16 Process Descriptor */
-       _u16            lrt_status;             /* 0x18 Current lrt status */
-       _u16            ltt_status;             /* 0x1A Current ltt status */
-       _u16            timeout;                /* 0x1C Timeout value */
-       _u16            topology;               /* 0x1E Topology bits */
-       _u16            mon_ltt;                /* 0x20 */
-       _u16            mon_lrt;                /* 0x22 */
-       _u16            num_pkts;               /* 0x24 */
-       _u16            add_packet_list;        /* 0x26 Add packets to here */
-       _u16            remove_packet_list;     /* 0x28 Send packets from here */
-
-       _u16            lrt_fail_chan;          /* 0x2A Lrt's failure channel */
-       _u16            ltt_fail_chan;          /* 0x2C Ltt's failure channel */
-
-       RUP             rup;                    /* 0x2E RUP structure for HOST to driver comms */
-       RUP             link_rup;               /* 0x40 RUP for the link (POLL, topology etc.) */
-       _u16            attached_link;          /* 0x52 Number of attached link */
-       _u16            csum_errors;            /* 0x54 csum errors */
-       _u16            num_disconnects;        /* 0x56 number of disconnects */
-       _u16            num_sync_rcvd;          /* 0x58 # sync's received */
-       _u16            num_sync_rqst;          /* 0x5A # sync requests */
-       _u16            num_tx;                 /* 0x5C Num pkts sent */
-       _u16            num_rx;                 /* 0x5E Num pkts received */
-       _u16            module_attached;        /* 0x60 Module tpyes of attached */
-       _u16            led_timeout;            /* 0x62 LED timeout */
-       _u16            first_port;             /* 0x64 First port to service */
-       _u16            last_port;              /* 0x66 Last port to service */
+typedef struct _LPB {
+       _u16 link_number;       /* 0x00 Link Number */
+       _u16 in_ch;             /* 0x02 Link In Channel */
+       _u16 out_ch;            /* 0x04 Link Out Channel */
+       _u8 attached_serial[4]; /* 0x06 Attached serial number */
+       _u8 attached_host_serial[4];    /* 0x0A Serial number of Host who booted other end */
+       _u16 descheduled;       /* 0x0E Currently Descheduled */
+       _u16 state;             /* 0x10 Current state */
+       _u16 send_poll;         /* 0x12 Send a Poll Packet */
+       _u16 ltt_p;             /* 0x14 Process Descriptor */
+       _u16 lrt_p;             /* 0x16 Process Descriptor */
+       _u16 lrt_status;        /* 0x18 Current lrt status */
+       _u16 ltt_status;        /* 0x1A Current ltt status */
+       _u16 timeout;           /* 0x1C Timeout value */
+       _u16 topology;          /* 0x1E Topology bits */
+       _u16 mon_ltt;           /* 0x20 */
+       _u16 mon_lrt;           /* 0x22 */
+       _u16 num_pkts;          /* 0x24 */
+       _u16 add_packet_list;   /* 0x26 Add packets to here */
+       _u16 remove_packet_list;        /* 0x28 Send packets from here */
+
+       _u16 lrt_fail_chan;     /* 0x2A Lrt's failure channel */
+       _u16 ltt_fail_chan;     /* 0x2C Ltt's failure channel */
+
+       RUP rup;                /* 0x2E RUP structure for HOST to driver comms */
+       RUP link_rup;           /* 0x40 RUP for the link (POLL, topology etc.) */
+       _u16 attached_link;     /* 0x52 Number of attached link */
+       _u16 csum_errors;       /* 0x54 csum errors */
+       _u16 num_disconnects;   /* 0x56 number of disconnects */
+       _u16 num_sync_rcvd;     /* 0x58 # sync's received */
+       _u16 num_sync_rqst;     /* 0x5A # sync requests */
+       _u16 num_tx;            /* 0x5C Num pkts sent */
+       _u16 num_rx;            /* 0x5E Num pkts received */
+       _u16 module_attached;   /* 0x60 Module tpyes of attached */
+       _u16 led_timeout;       /* 0x62 LED timeout */
+       _u16 first_port;        /* 0x64 First port to service */
+       _u16 last_port;         /* 0x66 Last port to service */
 
 } LPB;
 
 /* Same thing again, but defined as offsets... */
 
-#define        LPB_link_number         0x00            /* 0x00 Link Number */
-#define        LPB_in_ch               0x02            /* 0x02 Link In Channel */
-#define        LPB_out_ch              0x04            /* 0x04 Link Out Channel */
-#define        LPB_attached_serial     0x06            /* 0x06 Attached serial number */
-#define        LPB_attached_host_serial 0x0A           /* 0x0A Serial number of Host who booted other end */
-#define        LPB_descheduled         0x0E            /* 0x0E Currently Descheduled */
-#define        LPB_state               0x10            /* 0x10 Current state */
-#define        LPB_send_poll           0x12            /* 0x12 Send a Poll Packet */
-#define        LPB_ltt_p               0x14            /* 0x14 Process Descriptor */
-#define        LPB_lrt_p               0x16            /* 0x16 Process Descriptor */
-#define        LPB_lrt_status          0x18            /* 0x18 Current lrt status */
-#define        LPB_ltt_status          0x1A            /* 0x1A Current ltt status */
-#define        LPB_timeout             0x1C            /* 0x1C Timeout value */
-#define        LPB_topology            0x1E            /* 0x1E Topology bits */
-#define        LPB_mon_ltt             0x20            /* 0x20 */
-#define        LPB_mon_lrt             0x22            /* 0x22 */
-#define        LPB_num_pkts            0x24            /* 0x24 */
-#define        LPB_add_packet_list     0x26            /* 0x26 Add packets to here */
-#define        LPB_remove_packet_list  0x28            /* 0x28 Send packets from here */
-#define        LPB_lrt_fail_chan       0x2A            /* 0x2A Lrt's failure channel */
-#define        LPB_ltt_fail_chan       0x2C            /* 0x2C Ltt's failure channel */
-#define        LPB_rup                 0x2E            /* 0x2E RUP structure for HOST to driver comms */
-#define        LPB_link_rup            0x40            /* 0x40 RUP for the link (POLL, topology etc.) */
-#define        LPB_attached_link       0x52            /* 0x52 Number of attached link */
-#define        LPB_csum_errors         0x54            /* 0x54 csum errors */
-#define        LPB_num_disconnects     0x56            /* 0x56 number of disconnects */
-#define        LPB_num_sync_rcvd       0x58            /* 0x58 # sync's received */
-#define        LPB_num_sync_rqst       0x5A            /* 0x5A # sync requests */
-#define        LPB_num_tx              0x5C            /* 0x5C Num pkts sent */
-#define        LPB_num_rx              0x5E            /* 0x5E Num pkts received */
-#define        LPB_module_attached     0x60            /* 0x60 Module tpyes of attached */
-#define        LPB_led_timeout         0x62            /* 0x62 LED timeout */
-#define        LPB_first_port          0x64            /* 0x64 First port to service */
-#define        LPB_last_port           0x66            /* 0x66 Last port to service */
-#define        sizeof_LPB              0x68            /* structure size = 0x68 */
-
-#define        LINKS_PER_UNIT          4               /* number of links from a host */
+#define        LPB_link_number         0x00    /* 0x00 Link Number */
+#define        LPB_in_ch               0x02    /* 0x02 Link In Channel */
+#define        LPB_out_ch              0x04    /* 0x04 Link Out Channel */
+#define        LPB_attached_serial     0x06    /* 0x06 Attached serial number */
+#define        LPB_attached_host_serial 0x0A   /* 0x0A Serial number of Host who booted other end */
+#define        LPB_descheduled         0x0E    /* 0x0E Currently Descheduled */
+#define        LPB_state               0x10    /* 0x10 Current state */
+#define        LPB_send_poll           0x12    /* 0x12 Send a Poll Packet */
+#define        LPB_ltt_p               0x14    /* 0x14 Process Descriptor */
+#define        LPB_lrt_p               0x16    /* 0x16 Process Descriptor */
+#define        LPB_lrt_status          0x18    /* 0x18 Current lrt status */
+#define        LPB_ltt_status          0x1A    /* 0x1A Current ltt status */
+#define        LPB_timeout             0x1C    /* 0x1C Timeout value */
+#define        LPB_topology            0x1E    /* 0x1E Topology bits */
+#define        LPB_mon_ltt             0x20    /* 0x20 */
+#define        LPB_mon_lrt             0x22    /* 0x22 */
+#define        LPB_num_pkts            0x24    /* 0x24 */
+#define        LPB_add_packet_list     0x26    /* 0x26 Add packets to here */
+#define        LPB_remove_packet_list  0x28    /* 0x28 Send packets from here */
+#define        LPB_lrt_fail_chan       0x2A    /* 0x2A Lrt's failure channel */
+#define        LPB_ltt_fail_chan       0x2C    /* 0x2C Ltt's failure channel */
+#define        LPB_rup                 0x2E    /* 0x2E RUP structure for HOST to driver comms */
+#define        LPB_link_rup            0x40    /* 0x40 RUP for the link (POLL, topology etc.) */
+#define        LPB_attached_link       0x52    /* 0x52 Number of attached link */
+#define        LPB_csum_errors         0x54    /* 0x54 csum errors */
+#define        LPB_num_disconnects     0x56    /* 0x56 number of disconnects */
+#define        LPB_num_sync_rcvd       0x58    /* 0x58 # sync's received */
+#define        LPB_num_sync_rqst       0x5A    /* 0x5A # sync requests */
+#define        LPB_num_tx              0x5C    /* 0x5C Num pkts sent */
+#define        LPB_num_rx              0x5E    /* 0x5E Num pkts received */
+#define        LPB_module_attached     0x60    /* 0x60 Module tpyes of attached */
+#define        LPB_led_timeout         0x62    /* 0x62 LED timeout */
+#define        LPB_first_port          0x64    /* 0x64 First port to service */
+#define        LPB_last_port           0x66    /* 0x66 Last port to service */
+#define        sizeof_LPB              0x68    /* structure size = 0x68 */
+
+#define        LINKS_PER_UNIT          4       /* number of links from a host */
 
 /*****************************************************************************
 ********************************               *******************************
@@ -380,17 +376,16 @@ typedef   struct  _LPB
 
 /* Used to overlay packet headers when allocating/freeing packets from the free list */
 
-typedef        struct  _FREE_LIST
-{
-       _u16            next;                   /* 0x00 offset of next list item */
-       _u16            prev;                   /* 0x02 offset of previous list item */
+typedef struct _FREE_LIST {
+       _u16 next;              /* 0x00 offset of next list item */
+       _u16 prev;              /* 0x02 offset of previous list item */
 
 } FREE_LIST;
 
 /* Same thing again, but defined as offsets... */
 
-#define        FL_next                 0x00            /* 0x00 offset of next list item */
-#define        FL_prev                 0x02            /* 0x02 offset of previous list item */
+#define        FL_next                 0x00    /* 0x00 offset of next list item */
+#define        FL_prev                 0x02    /* 0x02 offset of previous list item */
 
 /*****************************************************************************
 **********************************         ***********************************
@@ -401,32 +396,31 @@ typedef   struct  _FREE_LIST
 /* The PKT is the main unit of communication between Host Cards and RTAs across
    the RIO network.  */
 
-#define PKT_MAX_DATA_LEN   72                  /* Size of packet data */
+#define PKT_MAX_DATA_LEN   72  /* Size of packet data */
 
-typedef        struct  _PKT
-{
-       _u8             dest_unit;              /* 0x00 Destination Unit Id */
-       _u8             dest_port;              /* 0x01 Destination Port */
-       _u8             src_unit;               /* 0x02 Source Unit Id */
-       _u8             src_port;               /* 0x03 Source Port */
-       _u8             len;                    /* 0x04 Length (in bytes) of data field */
-       _u8             control;                /* 0x05 */
-       _u8             data[PKT_MAX_DATA_LEN]; /* 0x06 Actual data */
-       _u16            csum;                   /* 0x4E C-SUM */
+typedef struct _PKT {
+       _u8 dest_unit;          /* 0x00 Destination Unit Id */
+       _u8 dest_port;          /* 0x01 Destination Port */
+       _u8 src_unit;           /* 0x02 Source Unit Id */
+       _u8 src_port;           /* 0x03 Source Port */
+       _u8 len;                /* 0x04 Length (in bytes) of data field */
+       _u8 control;            /* 0x05 */
+       _u8 data[PKT_MAX_DATA_LEN];     /* 0x06 Actual data */
+       _u16 csum;              /* 0x4E C-SUM */
 
 } PKT;
 
 /* Same thing again, but defined as offsets... */
 
-#define        PKT_dest_unit           0x00            /* 0x00 Destination Unit Id */
-#define        PKT_dest_port           0x01            /* 0x01 Destination Port */
-#define        PKT_src_unit            0x02            /* 0x02 Source Unit Id */
-#define        PKT_src_port            0x03            /* 0x03 Source Port */
-#define        PKT_len                 0x04            /* 0x04 Length (in bytes) of data field */
-#define        PKT_control             0x05            /* 0x05 */
-#define        PKT_data                0x06            /* 0x06 Actual data */
-#define        PKT_csum                0x4E            /* 0x4E C-SUM */
-#define        sizeof_PKT              0x50            /* structure size = 0x50 */
+#define        PKT_dest_unit           0x00    /* 0x00 Destination Unit Id */
+#define        PKT_dest_port           0x01    /* 0x01 Destination Port */
+#define        PKT_src_unit            0x02    /* 0x02 Source Unit Id */
+#define        PKT_src_port            0x03    /* 0x03 Source Port */
+#define        PKT_len                 0x04    /* 0x04 Length (in bytes) of data field */
+#define        PKT_control             0x05    /* 0x05 */
+#define        PKT_data                0x06    /* 0x06 Actual data */
+#define        PKT_csum                0x4E    /* 0x4E C-SUM */
+#define        sizeof_PKT              0x50    /* structure size = 0x50 */
 
 /* PKT.len definitions... */
 #define        PKT_CMD_BIT             0x80
@@ -449,38 +443,38 @@ typedef   struct  _PKT
 /* The following definitions and structures define the control packets sent
    between the driver and RIO Ports, RTAs and Host Cards. */
 
-#define        PRE_EMPTIVE             0x80                    /* Pre-emptive command (sent via port's RUP) */
+#define        PRE_EMPTIVE             0x80    /* Pre-emptive command (sent via port's RUP) */
 
 /* "in-band" and "pre-emptive" port commands... */
-#define        OPEN                    0x00                    /* Driver->RIO Open a port */
-#define        CONFIG                  0x01                    /* Driver->RIO Configure a port */
-#define        MOPEN                   0x02                    /* Driver->RIO Modem open (wait for DCD) */
-#define        CLOSE                   0x03                    /* Driver->RIO Close a port */
+#define        OPEN                    0x00    /* Driver->RIO Open a port */
+#define        CONFIG                  0x01    /* Driver->RIO Configure a port */
+#define        MOPEN                   0x02    /* Driver->RIO Modem open (wait for DCD) */
+#define        CLOSE                   0x03    /* Driver->RIO Close a port */
 #define        WFLUSH                  (0x04|PRE_EMPTIVE)      /* Driver->RIO Write flush */
 #define        RFLUSH                  (0x05|PRE_EMPTIVE)      /* Driver->RIO Read flush */
 #define        RESUME                  (0x06|PRE_EMPTIVE)      /* Driver->RIO Behave as if XON received */
-#define        SBREAK                  0x07                    /* Driver->RIO Start break */
-#define        EBREAK                  0x08                    /* Driver->RIO End break */
+#define        SBREAK                  0x07    /* Driver->RIO Start break */
+#define        EBREAK                  0x08    /* Driver->RIO End break */
 #define        SUSPEND                 (0x09|PRE_EMPTIVE)      /* Driver->RIO Behave as if XOFF received */
 #define        FCLOSE                  (0x0A|PRE_EMPTIVE)      /* Driver->RIO Force close */
-#define        XPRINT                  0x0B                    /* Driver->RIO Xprint packet */
+#define        XPRINT                  0x0B    /* Driver->RIO Xprint packet */
 #define        MBIS                    (0x0C|PRE_EMPTIVE)      /* Driver->RIO Set modem lines */
 #define        MBIC                    (0x0D|PRE_EMPTIVE)      /* Driver->RIO Clear modem lines */
 #define        MSET                    (0x0E|PRE_EMPTIVE)      /* Driver->RIO Set modem lines */
-#define        PCLOSE                  0x0F                    /* Driver->RIO Pseudo close */
+#define        PCLOSE                  0x0F    /* Driver->RIO Pseudo close */
 #define        MGET                    (0x10|PRE_EMPTIVE)      /* Driver->RIO Force update of modem status */
 #define        MEMDUMP                 (0x11|PRE_EMPTIVE)      /* Driver->RIO DEBUG request for RTA memory */
 #define        READ_REGISTER           (0x12|PRE_EMPTIVE)      /* Driver->RIO DEBUG read CD1400 register */
 
 /* Remote Unit Port (RUP) packet definitions... (specified in PKT.dest_unit and PKT.src_unit) */
-#define        SYNC_RUP                0xFF                    /* Download internal */
-#define        COMMAND_RUP             0xFE                    /* Command ack/status */
-#define        ERROR_RUP               0xFD                    /* Download internal */
-#define        POLL_RUP                0xFC                    /* Download internal */
-#define        BOOT_RUP                0xFB                    /* Used to boot RTAs */
-#define        ROUTE_RUP               0xFA                    /* Used to specify routing/topology */
-#define        STATUS_RUP              0xF9                    /* Not used */
-#define        POWER_RUP               0xF8                    /* Download internal */
+#define        SYNC_RUP                0xFF    /* Download internal */
+#define        COMMAND_RUP             0xFE    /* Command ack/status */
+#define        ERROR_RUP               0xFD    /* Download internal */
+#define        POLL_RUP                0xFC    /* Download internal */
+#define        BOOT_RUP                0xFB    /* Used to boot RTAs */
+#define        ROUTE_RUP               0xFA    /* Used to specify routing/topology */
+#define        STATUS_RUP              0xF9    /* Not used */
+#define        POWER_RUP               0xF8    /* Download internal */
 
 /* COMMAND_RUP definitions... */
 #define        COMPLETE                (0x20|PRE_EMPTIVE)      /* RIO->Driver Command complete */
@@ -488,24 +482,24 @@ typedef   struct  _PKT
 #define        MODEM_STATUS            (0x22|PRE_EMPTIVE)      /* RIO->Driver Modem status change */
 
 /* BOOT_RUP definitions... */
-#define        BOOT_REQUEST            0x00                    /* RIO->Driver Request for boot */
-#define        BOOT_ABORT              0x01                    /* Driver->RIO Abort a boot */
-#define        BOOT_SEQUENCE           0x02                    /* Driver->RIO Packet with firmware details */
-#define        BOOT_COMPLETED          0x03                    /* RIO->Driver Boot completed */
-#define IFOAD                  0x2F                    /* Driver->RIO Shutdown/Reboot RTA (Fall Over And Die) */
-#define        IDENTIFY                0x30                    /* Driver->RIO Identify RTA */
-#define        ZOMBIE                  0x31                    /* Driver->RIO Shutdown/Flash LEDs */
-#define        UFOAD                   0x32                    /* Driver->RIO Shutdown/Reboot neighbouring RTA */
-#define IWAIT                  0x33                    /* Driver->RIO Pause booting process */
+#define        BOOT_REQUEST            0x00    /* RIO->Driver Request for boot */
+#define        BOOT_ABORT              0x01    /* Driver->RIO Abort a boot */
+#define        BOOT_SEQUENCE           0x02    /* Driver->RIO Packet with firmware details */
+#define        BOOT_COMPLETED          0x03    /* RIO->Driver Boot completed */
+#define IFOAD                  0x2F    /* Driver->RIO Shutdown/Reboot RTA (Fall Over And Die) */
+#define        IDENTIFY                0x30    /* Driver->RIO Identify RTA */
+#define        ZOMBIE                  0x31    /* Driver->RIO Shutdown/Flash LEDs */
+#define        UFOAD                   0x32    /* Driver->RIO Shutdown/Reboot neighbouring RTA */
+#define IWAIT                  0x33    /* Driver->RIO Pause booting process */
 
 /* ROUTE_RUP definitions... */
-#define        ROUTE_REQUEST           0x00                    /* RIO->Driver Request an ID */
-#define        ROUTE_FOAD              0x01                    /* Driver->RIO Shutdown/reboot RTA */
-#define        ROUTE_ALREADY           0x02                    /* Driver->RIO Not used */
-#define        ROUTE_USED              0x03                    /* Driver->RIO Not used */
-#define        ROUTE_ALLOCATE          0x04                    /* Driver->RIO Allocate RTA RUP numbers */
-#define        ROUTE_REQ_TOP           0x05                    /* Driver->RIO Not used */
-#define ROUTE_TOPOLOGY         0x06                    /* RIO->Driver Route/Topology status */
+#define        ROUTE_REQUEST           0x00    /* RIO->Driver Request an ID */
+#define        ROUTE_FOAD              0x01    /* Driver->RIO Shutdown/reboot RTA */
+#define        ROUTE_ALREADY           0x02    /* Driver->RIO Not used */
+#define        ROUTE_USED              0x03    /* Driver->RIO Not used */
+#define        ROUTE_ALLOCATE          0x04    /* Driver->RIO Allocate RTA RUP numbers */
+#define        ROUTE_REQ_TOP           0x05    /* Driver->RIO Not used */
+#define ROUTE_TOPOLOGY         0x06    /* RIO->Driver Route/Topology status */
 
 /*****************************************************************************
 **********************************          **********************************
@@ -518,89 +512,89 @@ typedef   struct  _PKT
    Sent to open a port. 
    Structure of configuration info used with OPEN, CONFIG and MOPEN packets... */
 
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_Cor1                (PKT_Data+1)            /* Channel Option Register 1 */
-#define        PKT_Cor2                (PKT_Data+2)            /* Channel Option Register 2 */
-#define        PKT_Cor4                (PKT_Data+3)            /* Channel Option Register 4 */
-#define        PKT_Cor5                (PKT_Data+4)            /* Channel Option Register 5 */
-#define        PKT_TxXon               (PKT_Data+5)            /* Transmit XON character */
-#define        PKT_TxXoff              (PKT_Data+6)            /* Transmit XOFF character */
-#define        PKT_RxXon               (PKT_Data+7)            /* Receive XON character */
-#define        PKT_RxXoff              (PKT_Data+8)            /* Receive XOFF character */
-#define        PKT_Lnext               (PKT_Data+9)            /* Lnext character */
-#define        PKT_TxBaud              (PKT_Data+10)           /* Transmit baud rate */
-#define        PKT_RxBaud              (PKT_Data+11)           /* Receive baud rate */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_Cor1                (PKT_Data+1)    /* Channel Option Register 1 */
+#define        PKT_Cor2                (PKT_Data+2)    /* Channel Option Register 2 */
+#define        PKT_Cor4                (PKT_Data+3)    /* Channel Option Register 4 */
+#define        PKT_Cor5                (PKT_Data+4)    /* Channel Option Register 5 */
+#define        PKT_TxXon               (PKT_Data+5)    /* Transmit XON character */
+#define        PKT_TxXoff              (PKT_Data+6)    /* Transmit XOFF character */
+#define        PKT_RxXon               (PKT_Data+7)    /* Receive XON character */
+#define        PKT_RxXoff              (PKT_Data+8)    /* Receive XOFF character */
+#define        PKT_Lnext               (PKT_Data+9)    /* Lnext character */
+#define        PKT_TxBaud              (PKT_Data+10)   /* Transmit baud rate */
+#define        PKT_RxBaud              (PKT_Data+11)   /* Receive baud rate */
 
 /* COR1 definitions... */
-#define        COR1_PARITY             0xE0                    /* Parity mask */
-#define        COR1_NONE               0x00                    /* No parity */
-#define        COR1_SPACE              0x20                    /* Space parity */
-#define        COR1_EVEN               0x40                    /* Even parity */
-#define        COR1_MARK               0xA0                    /* Mark parity */
-#define        COR1_ODD                0xC0                    /* Odd parity */
-
-#define        COR1_STOPBITS           0x0C                    /* Stop bits mask */
-#define        COR1_STOP1              0x00                    /* 1 stop bit */
-#define        COR1_STOP1_5            0x04                    /* 1.5 stop bits */
-#define        COR1_STOP2              0x08                    /* 2 stop bits */
-
-#define        COR1_DATABITS           0x03                    /* Data bits mask */
-#define        COR1_DATA5              0x00                    /* 5 data bits */
-#define        COR1_DATA6              0x01                    /* 6 data bits */
-#define        COR1_DATA7              0x02                    /* 7 data bits */
-#define        COR1_DATA8              0x03                    /* 8 data bits */
+#define        COR1_PARITY             0xE0    /* Parity mask */
+#define        COR1_NONE               0x00    /* No parity */
+#define        COR1_SPACE              0x20    /* Space parity */
+#define        COR1_EVEN               0x40    /* Even parity */
+#define        COR1_MARK               0xA0    /* Mark parity */
+#define        COR1_ODD                0xC0    /* Odd parity */
+
+#define        COR1_STOPBITS           0x0C    /* Stop bits mask */
+#define        COR1_STOP1              0x00    /* 1 stop bit */
+#define        COR1_STOP1_5            0x04    /* 1.5 stop bits */
+#define        COR1_STOP2              0x08    /* 2 stop bits */
+
+#define        COR1_DATABITS           0x03    /* Data bits mask */
+#define        COR1_DATA5              0x00    /* 5 data bits */
+#define        COR1_DATA6              0x01    /* 6 data bits */
+#define        COR1_DATA7              0x02    /* 7 data bits */
+#define        COR1_DATA8              0x03    /* 8 data bits */
 
 /* COR2 definitions... */
-#define        COR2_XON_TXFLOW         0x40                    /* XON/XOFF Transmit Flow */
-#define        COR2_XANY_TXFLOW        0xC0                    /* XON/XANY Transmit Flow */
-#define        COR2_HUPCL              0x20                    /* Hang Up On Close */
-#define        COR2_DSR_TXFLOW         0x08                    /* DSR Transmit Flow Control */
-#define        COR2_RTS_RXFLOW         0x04                    /* RTS Receive Flow Control */
-#define        COR2_CTS_TXFLOW         0x02                    /* CTS Transmit Flow Control */
-#define        COR2_XON_RXFLOW         0x01                    /* XON/XOFF Receive Flow */
+#define        COR2_XON_TXFLOW         0x40    /* XON/XOFF Transmit Flow */
+#define        COR2_XANY_TXFLOW        0xC0    /* XON/XANY Transmit Flow */
+#define        COR2_HUPCL              0x20    /* Hang Up On Close */
+#define        COR2_DSR_TXFLOW         0x08    /* DSR Transmit Flow Control */
+#define        COR2_RTS_RXFLOW         0x04    /* RTS Receive Flow Control */
+#define        COR2_CTS_TXFLOW         0x02    /* CTS Transmit Flow Control */
+#define        COR2_XON_RXFLOW         0x01    /* XON/XOFF Receive Flow */
 
 /* COR4 definition... */
-#define        COR4_IGNCR              0x80                    /* Discard received CR */
-#define        COR4_ICRNL              0x40                    /* Map received CR -> NL */
-#define        COR4_INLCR              0x20                    /* Map received NL -> CR */
-#define        COR4_IGNBRK             0x10                    /* Ignore Received Break */
-#define        COR4_NBRKINT            0x08                    /* No interrupt on rx Break */
-#define        COR4_IGNPAR             0x04                    /* ignore rx parity error chars */
-#define        COR4_PARMRK             0x02                    /* Mark rx parity error chars */
-#define        COR4_RAISEMOD           0x01                    /* Raise modem lines on !0 baud */
+#define        COR4_IGNCR              0x80    /* Discard received CR */
+#define        COR4_ICRNL              0x40    /* Map received CR -> NL */
+#define        COR4_INLCR              0x20    /* Map received NL -> CR */
+#define        COR4_IGNBRK             0x10    /* Ignore Received Break */
+#define        COR4_NBRKINT            0x08    /* No interrupt on rx Break */
+#define        COR4_IGNPAR             0x04    /* ignore rx parity error chars */
+#define        COR4_PARMRK             0x02    /* Mark rx parity error chars */
+#define        COR4_RAISEMOD           0x01    /* Raise modem lines on !0 baud */
 
 /* COR5 definitions... */
-#define        COR5_ISTRIP             0x80                    /* Strip input chars to 7 bits */
-#define        COR5_LNE                0x40                    /* Enable LNEXT processing */
-#define        COR5_CMOE               0x20                    /* Match good & error characters */
-#define        COR5_TAB3               0x10                    /* TAB3 mode */
-#define        COR5_TSTATE_ON          0x08                    /* Enable tbusy/tstop monitoring */
-#define        COR5_TSTATE_OFF         0x04                    /* Disable tbusy/tstop monitoring */
-#define        COR5_ONLCR              0x02                    /* NL -> CR NL on output */
-#define        COR5_OCRNL              0x01                    /* CR -> NL on output */
+#define        COR5_ISTRIP             0x80    /* Strip input chars to 7 bits */
+#define        COR5_LNE                0x40    /* Enable LNEXT processing */
+#define        COR5_CMOE               0x20    /* Match good & error characters */
+#define        COR5_TAB3               0x10    /* TAB3 mode */
+#define        COR5_TSTATE_ON          0x08    /* Enable tbusy/tstop monitoring */
+#define        COR5_TSTATE_OFF         0x04    /* Disable tbusy/tstop monitoring */
+#define        COR5_ONLCR              0x02    /* NL -> CR NL on output */
+#define        COR5_OCRNL              0x01    /* CR -> NL on output */
 
 /* RxBaud and TxBaud definitions... */
-#define        RIO_B0                  0x00                    /* RTS / DTR signals dropped */
-#define        RIO_B50                 0x01                    /* 50 baud */
-#define        RIO_B75                 0x02                    /* 75 baud */
-#define        RIO_B110                0x03                    /* 110 baud */
-#define        RIO_B134                0x04                    /* 134.5 baud */
-#define        RIO_B150                0x05                    /* 150 baud */
-#define        RIO_B200                0x06                    /* 200 baud */
-#define        RIO_B300                0x07                    /* 300 baud */
-#define        RIO_B600                0x08                    /* 600 baud */
-#define        RIO_B1200               0x09                    /* 1200 baud */
-#define        RIO_B1800               0x0A                    /* 1800 baud */
-#define        RIO_B2400               0x0B                    /* 2400 baud */
-#define        RIO_B4800               0x0C                    /* 4800 baud */
-#define        RIO_B9600               0x0D                    /* 9600 baud */
-#define        RIO_B19200              0x0E                    /* 19200 baud */
-#define        RIO_B38400              0x0F                    /* 38400 baud */
-#define        RIO_B56000              0x10                    /* 56000 baud */
-#define        RIO_B57600              0x11                    /* 57600 baud */
-#define        RIO_B64000              0x12                    /* 64000 baud */
-#define        RIO_B115200             0x13                    /* 115200 baud */
-#define        RIO_B2000               0x14                    /* 2000 baud */
+#define        RIO_B0                  0x00    /* RTS / DTR signals dropped */
+#define        RIO_B50                 0x01    /* 50 baud */
+#define        RIO_B75                 0x02    /* 75 baud */
+#define        RIO_B110                0x03    /* 110 baud */
+#define        RIO_B134                0x04    /* 134.5 baud */
+#define        RIO_B150                0x05    /* 150 baud */
+#define        RIO_B200                0x06    /* 200 baud */
+#define        RIO_B300                0x07    /* 300 baud */
+#define        RIO_B600                0x08    /* 600 baud */
+#define        RIO_B1200               0x09    /* 1200 baud */
+#define        RIO_B1800               0x0A    /* 1800 baud */
+#define        RIO_B2400               0x0B    /* 2400 baud */
+#define        RIO_B4800               0x0C    /* 4800 baud */
+#define        RIO_B9600               0x0D    /* 9600 baud */
+#define        RIO_B19200              0x0E    /* 19200 baud */
+#define        RIO_B38400              0x0F    /* 38400 baud */
+#define        RIO_B56000              0x10    /* 56000 baud */
+#define        RIO_B57600              0x11    /* 57600 baud */
+#define        RIO_B64000              0x12    /* 64000 baud */
+#define        RIO_B115200             0x13    /* 115200 baud */
+#define        RIO_B2000               0x14    /* 2000 baud */
 
 /*****************************************************************************
 *********************************            *********************************
@@ -636,7 +630,7 @@ typedef     struct  _PKT
    No parameters.
  */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
 /*****************************************************************************
 *********************************            *********************************
@@ -653,9 +647,9 @@ typedef     struct  _PKT
    write flushing previously started by a pre-emptive WFLUSH packet. (in-band)
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 
 /*****************************************************************************
 *********************************            *********************************
@@ -669,8 +663,8 @@ typedef     struct  _PKT
    packets of a port.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 #endif
 
 /*****************************************************************************
@@ -685,8 +679,8 @@ typedef     struct  _PKT
    transmission of data if blocked by XOFF.  (as if XON had been received)
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 #endif
 
 /*****************************************************************************
@@ -707,9 +701,9 @@ typedef     struct  _PKT
    specified number of mS.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_BreakDelay          (PKT_Data+1)            /* Break delay in mS */
+#define        PKT_BreakDelay          (PKT_Data+1)    /* Break delay in mS */
 
 /*****************************************************************************
 *********************************            *********************************
@@ -736,8 +730,8 @@ typedef     struct  _PKT
    transmission of data.  (as if XOFF had been received)
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 #endif
 
 /*****************************************************************************
@@ -753,8 +747,8 @@ typedef     struct  _PKT
    modem signals if the COR5_HUPCL (Hang Up On Close) flag is set.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 #endif
 
 /*****************************************************************************
@@ -774,8 +768,8 @@ typedef     struct  _PKT
    -   Transparent Print Stop Sequence.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 #endif
 
 /*****************************************************************************
@@ -789,14 +783,14 @@ typedef   struct  _PKT
    MBIS is sent pre-emptively from the driver to set a port's modem signals.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 #endif
-#define        PKT_ModemSet            (PKT_Data+4)            /* Modem set signals mask */
+#define        PKT_ModemSet            (PKT_Data+4)    /* Modem set signals mask */
 
 /* ModemSet definitions... */
-#define        MBIS_RTS                0x01                    /* RTS modem signal */
-#define        MBIS_DTR                0x02                    /* DTR modem signal */
+#define        MBIS_RTS                0x01    /* RTS modem signal */
+#define        MBIS_DTR                0x02    /* DTR modem signal */
 
 /*****************************************************************************
 **********************************          **********************************
@@ -808,16 +802,16 @@ typedef   struct  _PKT
 
    MBIC is sent pre-emptively from the driver to clear a port's modem signals.
    */
-#if 0   
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#if 0
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 #endif
 
-#define        PKT_ModemClear          (PKT_Data+4)            /* Modem clear signals mask */
+#define        PKT_ModemClear          (PKT_Data+4)    /* Modem clear signals mask */
 
 /* ModemClear definitions... */
-#define        MBIC_RTS                0x01                    /* RTS modem signal */
-#define        MBIC_DTR                0x02                    /* DTR modem signal */
+#define        MBIC_RTS                0x01    /* RTS modem signal */
+#define        MBIC_DTR                0x02    /* DTR modem signal */
 
 /*****************************************************************************
 **********************************          **********************************
@@ -829,15 +823,15 @@ typedef   struct  _PKT
 
    MSET is sent pre-emptively from the driver to set/clear a port's modem signals. */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 #endif
 
-#define        PKT_ModemSet            (PKT_Data+4)            /* Modem set signals mask */
+#define        PKT_ModemSet            (PKT_Data+4)    /* Modem set signals mask */
 
 /* ModemSet definitions... */
-#define        MSET_RTS                0x01                    /* RTS modem signal */
-#define        MSET_DTR                0x02                    /* DTR modem signal */
+#define        MSET_RTS                0x01    /* RTS modem signal */
+#define        MSET_DTR                0x02    /* DTR modem signal */
 
 /*****************************************************************************
 *********************************            *********************************
@@ -853,7 +847,7 @@ typedef     struct  _PKT
    port's transmit / receive and modem signals will be left enabled and the
    port marked internally as Pseudo Closed. */
 
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 
 /*****************************************************************************
 **********************************          **********************************
@@ -865,8 +859,8 @@ typedef     struct  _PKT
 
    MGET is sent pre-emptively from the driver to request the port's current modem signals. */
 
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
 
 /*****************************************************************************
 *********************************             ********************************
@@ -880,11 +874,11 @@ typedef   struct  _PKT
    of the specified port's RTA address space.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
-#define        PKT_SubCmd              (PKT_Data+5)            /* Sub Command */
-#define        PKT_Address             (PKT_Data+6)            /* Requested address */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
+#define        PKT_SubCmd              (PKT_Data+5)    /* Sub Command */
+#define        PKT_Address             (PKT_Data+6)    /* Requested address */
 
 /*****************************************************************************
 ******************************                   *****************************
@@ -898,11 +892,11 @@ typedef   struct  _PKT
    of the CD1400 register specified in address.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
-#define        PKT_SubCmd              (PKT_Data+5)            /* Sub Command */
-#define        PKT_Address             (PKT_Data+6)            /* Requested address */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
+#define        PKT_SubCmd              (PKT_Data+5)    /* Sub Command */
+#define        PKT_Address             (PKT_Data+6)    /* Requested address */
 
 /*****************************************************************************
 ************************                            **************************
@@ -916,33 +910,33 @@ typedef   struct  _PKT
    packets, except MEMDUMP and READ_REGISTER.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
-#define        PKT_Cmd2                (PKT_Data+2)            /* Command code copy */
-#define        PKT_ModemStatus         (PKT_Data+3)            /* Modem signal status */
-#define        PKT_PortStatus          (PKT_Data+4)            /* Port signal status */
-#define        PKT_SubCmd              (PKT_Data+5)            /* Sub Command */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
+#define        PKT_Cmd2                (PKT_Data+2)    /* Command code copy */
+#define        PKT_ModemStatus         (PKT_Data+3)    /* Modem signal status */
+#define        PKT_PortStatus          (PKT_Data+4)    /* Port signal status */
+#define        PKT_SubCmd              (PKT_Data+5)    /* Sub Command */
 
 /* ModemStatus definitions... */
-#define        MODEM_DSR               0x80                    /* Data Set Ready modem state */
-#define        MODEM_CTS               0x40                    /* Clear To Send modem state */
-#define        MODEM_RI                0x20                    /* Ring Indicate modem state */
-#define        MODEM_CD                0x10                    /* Carrier Detect modem state */
-#define        MODEM_TSTOP             0x08                    /* Transmit Stopped state */
-#define        MODEM_TEMPTY            0x04                    /* Transmit Empty state */
-#define        MODEM_DTR               0x02                    /* DTR modem output state */
-#define        MODEM_RTS               0x01                    /* RTS modem output state */
+#define        MODEM_DSR               0x80    /* Data Set Ready modem state */
+#define        MODEM_CTS               0x40    /* Clear To Send modem state */
+#define        MODEM_RI                0x20    /* Ring Indicate modem state */
+#define        MODEM_CD                0x10    /* Carrier Detect modem state */
+#define        MODEM_TSTOP             0x08    /* Transmit Stopped state */
+#define        MODEM_TEMPTY            0x04    /* Transmit Empty state */
+#define        MODEM_DTR               0x02    /* DTR modem output state */
+#define        MODEM_RTS               0x01    /* RTS modem output state */
 
 /* PortStatus definitions... */
-#define        PORT_ISOPEN             0x01                    /* Port open ? */
-#define        PORT_HUPCL              0x02                    /* Hangup on close? */
-#define        PORT_MOPENPEND          0x04                    /* Modem open pending */
-#define        PORT_ISPARALLEL         0x08                    /* Parallel port */
-#define        PORT_BREAK              0x10                    /* Port on break */
-#define        PORT_STATUSPEND         0020                    /* Status packet pending */
-#define        PORT_BREAKPEND          0x40                    /* Break packet pending */
-#define        PORT_MODEMPEND          0x80                    /* Modem status packet pending */
+#define        PORT_ISOPEN             0x01    /* Port open ? */
+#define        PORT_HUPCL              0x02    /* Hangup on close? */
+#define        PORT_MOPENPEND          0x04    /* Modem open pending */
+#define        PORT_ISPARALLEL         0x08    /* Parallel port */
+#define        PORT_BREAK              0x10    /* Port on break */
+#define        PORT_STATUSPEND         0020    /* Status packet pending */
+#define        PORT_BREAKPEND          0x40    /* Break packet pending */
+#define        PORT_MODEMPEND          0x80    /* Modem status packet pending */
 
 /*****************************************************************************
 ************************                            **************************
@@ -956,35 +950,35 @@ typedef   struct  _PKT
    packets, except MEMDUMP and READ_REGISTER.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
-#define        PKT_Cmd2                (PKT_Data+2)            /* Command code copy */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
+#define        PKT_Cmd2                (PKT_Data+2)    /* Command code copy */
 #endif
-#define        PKT_ModemStatus         (PKT_Data+3)            /* Modem signal status */
-#define        PKT_PortStatus          (PKT_Data+4)            /* Port signal status */
+#define        PKT_ModemStatus         (PKT_Data+3)    /* Modem signal status */
+#define        PKT_PortStatus          (PKT_Data+4)    /* Port signal status */
 #if 0
-#define        PKT_SubCmd              (PKT_Data+5)            /* Sub Command */
+#define        PKT_SubCmd              (PKT_Data+5)    /* Sub Command */
 #endif
 
 /* ModemStatus definitions... */
-#define        MODEM_DSR               0x80                    /* Data Set Ready modem state */
-#define        MODEM_CTS               0x40                    /* Clear To Send modem state */
-#define        MODEM_RI                0x20                    /* Ring Indicate modem state */
-#define        MODEM_CD                0x10                    /* Carrier Detect modem state */
-#define        MODEM_TSTOP             0x08                    /* Transmit Stopped state */
-#define        MODEM_TEMPTY            0x04                    /* Transmit Empty state */
-#define        MODEM_DTR               0x02                    /* DTR modem output state */
-#define        MODEM_RTS               0x01                    /* RTS modem output state */
+#define        MODEM_DSR               0x80    /* Data Set Ready modem state */
+#define        MODEM_CTS               0x40    /* Clear To Send modem state */
+#define        MODEM_RI                0x20    /* Ring Indicate modem state */
+#define        MODEM_CD                0x10    /* Carrier Detect modem state */
+#define        MODEM_TSTOP             0x08    /* Transmit Stopped state */
+#define        MODEM_TEMPTY            0x04    /* Transmit Empty state */
+#define        MODEM_DTR               0x02    /* DTR modem output state */
+#define        MODEM_RTS               0x01    /* RTS modem output state */
 
 /* PortStatus definitions... */
-#define        PORT_ISOPEN             0x01                    /* Port open ? */
-#define        PORT_HUPCL              0x02                    /* Hangup on close? */
-#define        PORT_MOPENPEND          0x04                    /* Modem open pending */
-#define        PORT_ISPARALLEL         0x08                    /* Parallel port */
-#define        PORT_BREAK              0x10                    /* Port on break */
-#define        PORT_STATUSPEND         0020                    /* Status packet pending */
-#define        PORT_BREAKPEND          0x40                    /* Break packet pending */
-#define        PORT_MODEMPEND          0x80                    /* Modem status packet pending */
+#define        PORT_ISOPEN             0x01    /* Port open ? */
+#define        PORT_HUPCL              0x02    /* Hangup on close? */
+#define        PORT_MOPENPEND          0x04    /* Modem open pending */
+#define        PORT_ISPARALLEL         0x08    /* Parallel port */
+#define        PORT_BREAK              0x10    /* Port on break */
+#define        PORT_STATUSPEND         0020    /* Status packet pending */
+#define        PORT_BREAKPEND          0x40    /* Break packet pending */
+#define        PORT_MODEMPEND          0x80    /* Modem status packet pending */
 
 /*****************************************************************************
 ********************                                      ********************
@@ -998,15 +992,15 @@ typedef   struct  _PKT
    port I/O control command packet.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
-#define        PKT_Cmd2                (PKT_Data+2)            /* Command code copy */
-#define        PKT_ModemStatus         (PKT_Data+3)            /* Modem signal status */
-#define        PKT_PortStatus          (PKT_Data+4)            /* Port signal status */
-#define        PKT_SubCmd              (PKT_Data+5)            /* Sub Command */
-#define        PKT_Address             (PKT_Data+6)            /* Requested address */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
+#define        PKT_Cmd2                (PKT_Data+2)    /* Command code copy */
+#define        PKT_ModemStatus         (PKT_Data+3)    /* Modem signal status */
+#define        PKT_PortStatus          (PKT_Data+4)    /* Port signal status */
+#define        PKT_SubCmd              (PKT_Data+5)    /* Sub Command */
+#define        PKT_Address             (PKT_Data+6)    /* Requested address */
 #endif
-#define        PKT_Dump                (PKT_Data+8)            /* 32bytes of requested dump data */
+#define        PKT_Dump                (PKT_Data+8)    /* 32bytes of requested dump data */
 
 /*****************************************************************************
 *****************                                            *****************
@@ -1020,14 +1014,14 @@ typedef struct  _PKT
    READ_REGISTER port I/O control command packet.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /*Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /*Port number wrt RTA */
-#define        PKT_Cmd2                (PKT_Data+2)            /* Command code copy */
+#define        PKT_Cmd                 (PKT_Data+0)    /*Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /*Port number wrt RTA */
+#define        PKT_Cmd2                (PKT_Data+2)    /* Command code copy */
 #endif
-#define        PKT_RegisterValue       (PKT_Data+3)            /* Modem signal status */
+#define        PKT_RegisterValue       (PKT_Data+3)    /* Modem signal status */
 #if 0
-#define        PKT_PortStatus          (PKT_Data+4)            /* Port signal status */
-#define        PKT_SubCmd              (PKT_Data+5)            /* Sub Command */
+#define        PKT_PortStatus          (PKT_Data+4)    /* Port signal status */
+#define        PKT_SubCmd              (PKT_Data+5)    /* Sub Command */
 #endif
 
 /*****************************************************************************
@@ -1041,9 +1035,9 @@ typedef   struct  _PKT
    COMMAND_RUP - BREAK_RECEIVED packets are sent when the port detects a receive BREAK signal.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
-#define        PKT_Cmd2                (PKT_Data+2)            /* Command code copy */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
+#define        PKT_Cmd2                (PKT_Data+2)    /* Command code copy */
 #endif
 
 /*****************************************************************************
@@ -1059,10 +1053,10 @@ typedef struct  _PKT
 
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_PhbNum              (PKT_Data+1)            /* Port number wrt RTA */
-#define        PKT_Cmd2                (PKT_Data+2)            /* Command code copy */
-#define        PKT_ModemStatus         (PKT_Data+3)            /* Modem signal status */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_PhbNum              (PKT_Data+1)    /* Port number wrt RTA */
+#define        PKT_Cmd2                (PKT_Data+2)    /* Command code copy */
+#define        PKT_ModemStatus         (PKT_Data+3)    /* Modem signal status */
 #endif
 
 /*****************************************************************************
@@ -1077,7 +1071,7 @@ typedef   struct  _PKT
    firmware code to load onto attached RTAs.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
 
 /*****************************************************************************
@@ -1092,12 +1086,12 @@ typedef struct  _PKT
    to a BOOT_RUP - BOOT_REQUEST packet.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_NumPackets          (PKT_Data+2)            /* Packets required to load firmware */
-#define        PKT_LoadBase            (PKT_Data+4)            /* RTA firmware load address */
-#define        PKT_CodeSize            (PKT_Data+6)            /* Size of firmware in bytes */
-#define        PKT_CmdString           (PKT_Data+8)            /* Command string */
+#define        PKT_NumPackets          (PKT_Data+2)    /* Packets required to load firmware */
+#define        PKT_LoadBase            (PKT_Data+4)    /* RTA firmware load address */
+#define        PKT_CodeSize            (PKT_Data+6)    /* Size of firmware in bytes */
+#define        PKT_CmdString           (PKT_Data+8)    /* Command string */
 
 /*****************************************************************************
 ************************                               ***********************
@@ -1111,10 +1105,10 @@ typedef struct  _PKT
    RTA firmware has completed.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_LinkNumber          (PKT_Data+1)            /* Link number RTA booted on */
-#define        PKT_SerialNumber        (PKT_Data+2)            /* 4 byte serial number */
+#define        PKT_LinkNumber          (PKT_Data+1)    /* Link number RTA booted on */
+#define        PKT_SerialNumber        (PKT_Data+2)    /* 4 byte serial number */
 
 /*****************************************************************************
 ************************                               ***********************
@@ -1127,7 +1121,7 @@ typedef   struct  _PKT
    BOOT_RUP packet without the PKT_CMD_BIT set in the PKT->len field is sent
    from RIO to the Driver as a request for a firmware boot packet. */
 
-#define        PKT_SequenceNumber      (PKT_Data+0)            /* Packet sequence number */
+#define        PKT_SequenceNumber      (PKT_Data+0)    /* Packet sequence number */
 
 /*****************************************************************************
 ***********************                                ***********************
@@ -1141,9 +1135,9 @@ typedef   struct  _PKT
    packet with the 70 bytes of the requested sequence.
    */
 #if 0
-#define        PKT_SequenceNumber      (PKT_Data+0)            /* Packet sequence number */
+#define        PKT_SequenceNumber      (PKT_Data+0)    /* Packet sequence number */
 #endif
-#define        PKT_FirmwarePacket      (PKT_Data+2)            /* Firmware packet */
+#define        PKT_FirmwarePacket      (PKT_Data+2)    /* Firmware packet */
 
 /*****************************************************************************
 ****************************                      ****************************
@@ -1157,10 +1151,10 @@ typedef struct  _PKT
    RTA to shut down and reboot.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_IfoadId1            (PKT_Data+2)            /* IFOAD Id 1 */
-#define        PKT_IfoadId2            (PKT_Data+3)            /* IFOAD Id 2 */
+#define        PKT_IfoadId1            (PKT_Data+2)    /* IFOAD Id 1 */
+#define        PKT_IfoadId2            (PKT_Data+3)    /* IFOAD Id 2 */
 
 #define        IFOADID1                0xAD
 #define        IFOADID2                0xF0
@@ -1177,9 +1171,9 @@ typedef   struct  _PKT
    RTA to flash its LEDs for a period of time.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_IdentifyId          (PKT_Data+2)            /* defines pattern to flash */
+#define        PKT_IdentifyId          (PKT_Data+2)    /* defines pattern to flash */
 
 /*****************************************************************************
 ****************************                       ***************************
@@ -1193,10 +1187,10 @@ typedef struct  _PKT
    RTA to shut down and flash it's LEDs.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_ZombieId1           (PKT_Data+2)            /* ZOMBIE Id 1 */
-#define        PKT_ZombieId2           (PKT_Data+3)            /* ZOMBIE Id 2 */
+#define        PKT_ZombieId1           (PKT_Data+2)    /* ZOMBIE Id 1 */
+#define        PKT_ZombieId2           (PKT_Data+3)    /* ZOMBIE Id 2 */
 
 #define        ZOMBIEID1               0x52
 #define        ZOMBIEID2               0x21
@@ -1213,11 +1207,11 @@ typedef struct  _PKT
    to ask it's neighbouring RTA to shut down and reboot.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_LinkNumber          (PKT_Data+1)            /* Link number of RTA to UFOAD */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_LinkNumber          (PKT_Data+1)    /* Link number of RTA to UFOAD */
 #endif
-#define        PKT_UfoadId1            (PKT_Data+2)            /* UFOAD Id 1 */
-#define        PKT_UfoadId2            (PKT_Data+3)            /* UFOAD Id 2 */
+#define        PKT_UfoadId1            (PKT_Data+2)    /* UFOAD Id 1 */
+#define        PKT_UfoadId2            (PKT_Data+3)    /* UFOAD Id 2 */
 
 #define        UFOADID1                0x1E
 #define        UFOADID2                0x0D
@@ -1234,11 +1228,11 @@ typedef struct  _PKT
    to pause booting on the specified link for 30 seconds.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
-#define        PKT_LinkNumber          (PKT_Data+1)            /* Link number of RTA to UFOAD */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
+#define        PKT_LinkNumber          (PKT_Data+1)    /* Link number of RTA to UFOAD */
 #endif
-#define        PKT_IwaitId1            (PKT_Data+2)            /* IWAIT Id 1 */
-#define        PKT_IwaitId2            (PKT_Data+3)            /* IWAIT Id 2 */
+#define        PKT_IwaitId1            (PKT_Data+2)    /* IWAIT Id 1 */
+#define        PKT_IwaitId2            (PKT_Data+3)    /* IWAIT Id 2 */
 
 #define        IWAITID1                0xDE
 #define        IWAITID2                0xB1
@@ -1255,20 +1249,20 @@ typedef struct  _PKT
    RTA to a Driver to request an ID (RUP or unit number).
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_SerialNumber        (PKT_Data+2)            /* 4 byte serial number */
-#define        PKT_ModuleTypes         (PKT_Data+6)            /* RTA Module types */
+#define        PKT_SerialNumber        (PKT_Data+2)    /* 4 byte serial number */
+#define        PKT_ModuleTypes         (PKT_Data+6)    /* RTA Module types */
 
 /* ModuleTypes definitions... */
-#define        MOD_BLANK               0x0F                    /* Blank plate attached */
-#define        MOD_RS232DB25           0x00                    /* RS232 DB25 connector */
-#define        MOD_RS232RJ45           0x01                    /* RS232 RJ45 connector */
-#define        MOD_RS422DB25           0x02                    /* RS422 DB25 connector */
-#define        MOD_RS485DB25           0x03                    /* RS485 DB25 connector */
-#define        MOD_PARALLEL            0x04                    /* Centronics parallel */
+#define        MOD_BLANK               0x0F    /* Blank plate attached */
+#define        MOD_RS232DB25           0x00    /* RS232 DB25 connector */
+#define        MOD_RS232RJ45           0x01    /* RS232 RJ45 connector */
+#define        MOD_RS422DB25           0x02    /* RS422 DB25 connector */
+#define        MOD_RS485DB25           0x03    /* RS485 DB25 connector */
+#define        MOD_PARALLEL            0x04    /* Centronics parallel */
 
-#define        MOD2                    0x08                    /* Set to indicate Rev2 module */
+#define        MOD2                    0x08    /* Set to indicate Rev2 module */
 
 /*****************************************************************************
 *************************                            *************************
@@ -1282,9 +1276,9 @@ typedef   struct  _PKT
    packet to cause the RTA to "Fall Over And Die"., i.e. shutdown and reboot.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_RouteCmdString      (PKT_Data+2)            /* Command string */
+#define        PKT_RouteCmdString      (PKT_Data+2)    /* Command string */
 
 /*****************************************************************************
 ***********************                                ***********************
@@ -1298,13 +1292,13 @@ typedef struct  _PKT
    packet to allocate the RTA's Id number (RUP number 1..16)
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_IdNum               (PKT_Data+1)            /* RUP number for ports 1..8 */
+#define        PKT_IdNum               (PKT_Data+1)    /* RUP number for ports 1..8 */
 #if 0
-#define        PKT_RouteCmdString      (PKT_Data+2)            /* Command string */
+#define        PKT_RouteCmdString      (PKT_Data+2)    /* Command string */
 #endif
-#define        PKT_IdNum2              (PKT_Data+0x17)         /* RUP number for ports 9..16 */
+#define        PKT_IdNum2              (PKT_Data+0x17) /* RUP number for ports 9..16 */
 
 /*****************************************************************************
 ***********************                                ***********************
@@ -1318,18 +1312,18 @@ typedef struct  _PKT
    current link status.
    */
 #if 0
-#define        PKT_Cmd                 (PKT_Data+0)            /* Command code */
+#define        PKT_Cmd                 (PKT_Data+0)    /* Command code */
 #endif
-#define        PKT_Link1Rup            (PKT_Data+2)            /* Link 1 RUP number */
-#define        PKT_Link1Link           (PKT_Data+3)            /* Link 1 link number */
-#define        PKT_Link2Rup            (PKT_Data+4)            /* Link 2 RUP number */
-#define        PKT_Link2Link           (PKT_Data+5)            /* Link 2 link number */
-#define        PKT_Link3Rup            (PKT_Data+6)            /* Link 3 RUP number */
-#define        PKT_Link3Link           (PKT_Data+7)            /* Link 3 link number */
-#define        PKT_Link4Rup            (PKT_Data+8)            /* Link 4 RUP number */
-#define        PKT_Link4Link           (PKT_Data+9)            /* Link 4 link number */
-#define        PKT_RtaVpdProm          (PKT_Data+10)           /* 32 bytes of RTA VPD PROM Contents */
-
-#endif                                         /* _sxwinif_h */
+#define        PKT_Link1Rup            (PKT_Data+2)    /* Link 1 RUP number */
+#define        PKT_Link1Link           (PKT_Data+3)    /* Link 1 link number */
+#define        PKT_Link2Rup            (PKT_Data+4)    /* Link 2 RUP number */
+#define        PKT_Link2Link           (PKT_Data+5)    /* Link 2 link number */
+#define        PKT_Link3Rup            (PKT_Data+6)    /* Link 3 RUP number */
+#define        PKT_Link3Link           (PKT_Data+7)    /* Link 3 link number */
+#define        PKT_Link4Rup            (PKT_Data+8)    /* Link 4 RUP number */
+#define        PKT_Link4Link           (PKT_Data+9)    /* Link 4 link number */
+#define        PKT_RtaVpdProm          (PKT_Data+10)   /* 32 bytes of RTA VPD PROM Contents */
+
+#endif                         /* _sxwinif_h */
 
 /* End of RIOWINIF.H */
index 7685cc1d9e7bbc564491f93d3081f94a5c3c52ed..60d66d0056ae3140690879ea9eb60a354620b3bd 100644 (file)
@@ -60,4 +60,4 @@ static char *_riscos_h_sccs_ = "@(#)riscos.h  1.2";
 #define RINDW(A)       (*(ushort *)(A))
 #define WINDW(A,V)     (*(ushort *)(A)=(ushort)(V))
 
-#endif /* __rio_riscos_h__ */
+#endif                         /* __rio_riscos_h__ */
index ee79b8e5b9727a4d1448e105bc1870a416e0b444..58a7843625ffd71507d0e637a085225a25da0b7c 100644 (file)
 
 #ifndef lint
 #ifdef SCCS
-static char *_rio_rom_h_sccs = "@(#)rom.h      1.1" ;
+static char *_rio_rom_h_sccs = "@(#)rom.h      1.1";
 #endif
 #endif
 
-typedef struct  ROM  ROM ;
-struct  ROM  {
-                 u_short    slx ;
-                 char       pcb_letter_rev ;
-                 char       pcb_number_rev ;
-                 char       serial[4] ;
-                 char       year ;
-                 char       week ;
-             } ;
+typedef struct ROM ROM;
+struct ROM {
+       u_short slx;
+       char pcb_letter_rev;
+       char pcb_number_rev;
+       char serial[4];
+       char year;
+       char week;
+};
 
 #endif
 
@@ -60,5 +60,3 @@ struct  ROM  {
 #define ROM_LENGTH  0x20
 
 /*********** end of file ***********/
-
-
index c42dbb97171897c28dabb46adef992b5035f4d36..769744e575aba6cb585a274bf9e2ece9053c767f 100644 (file)
 #endif
 
 #define MAX_LINKS 4
-#define MAX_NODES 17                          /* Maximum nodes in a subnet */
-#define NODE_BYTES ((MAX_NODES / 8) + 1)      /* Number of bytes needed for
-                                                 1 bit per node */
-#define ROUTE_DATA_SIZE  (NODE_BYTES + 2)     /* Number of bytes for complete 
-                                                 info about cost etc. */
+#define MAX_NODES 17           /* Maximum nodes in a subnet */
+#define NODE_BYTES ((MAX_NODES / 8) + 1)       /* Number of bytes needed for
+                                                  1 bit per node */
+#define ROUTE_DATA_SIZE  (NODE_BYTES + 2)      /* Number of bytes for complete
+                                                  info about cost etc. */
 #define ROUTES_PER_PACKET ((PKT_MAX_DATA_LEN -2)/ ROUTE_DATA_SIZE)
-                                              /* Number of nodes we can squeeze
-                                                 into one packet */
+                                             /* Number of nodes we can squeeze
+                                                into one packet */
 #define MAX_TOPOLOGY_PACKETS (MAX_NODES / ROUTES_PER_PACKET + 1)
 /************************************************
  * Define the types of command for the ROUTE RUP.
  ************************************************/
-#define ROUTE_REQUEST    0                    /* Request an ID */
-#define ROUTE_FOAD       1                    /* Kill the RTA */
-#define ROUTE_ALREADY    2                    /* ID given already */
-#define ROUTE_USED       3                    /* All ID's used */
-#define ROUTE_ALLOCATE   4                    /* Here it is */
-#define ROUTE_REQ_TOP    5                    /* I bet you didn't expect....
-                                                 the Topological Inquisition */
-#define ROUTE_TOPOLOGY   6                    /* Topology request answered FD */
+#define ROUTE_REQUEST    0     /* Request an ID */
+#define ROUTE_FOAD       1     /* Kill the RTA */
+#define ROUTE_ALREADY    2     /* ID given already */
+#define ROUTE_USED       3     /* All ID's used */
+#define ROUTE_ALLOCATE   4     /* Here it is */
+#define ROUTE_REQ_TOP    5     /* I bet you didn't expect....
+                                  the Topological Inquisition */
+#define ROUTE_TOPOLOGY   6     /* Topology request answered FD */
 /*******************************************************************
  * Define the Route Map Structure
  *
  ******************************************************************/
 typedef struct COST_ROUTE COST_ROUTE;
 struct COST_ROUTE {
-                      unsigned char cost;        /* Cost down this link */
-                      unsigned char route[NODE_BYTES]; /* Nodes thorough this route */
-                  } ;
+       unsigned char cost;     /* Cost down this link */
+       unsigned char route[NODE_BYTES];        /* Nodes thorough this route */
+};
 
-typedef struct ROUTE_STR ROUTE_STR ;
-struct  ROUTE_STR {
-                      COST_ROUTE cost_route[MAX_LINKS];
-                                                /* cost / route for this link */
-                      ushort favoured;          /* favoured link */
-                  } ;
+typedef struct ROUTE_STR ROUTE_STR;
+struct ROUTE_STR {
+       COST_ROUTE cost_route[MAX_LINKS];
+       /* cost / route for this link */
+       ushort favoured;        /* favoured link */
+};
 
 
-#define NO_LINK            (short) 5      /* Link unattached */
-#define ROUTE_NO_ID        (short) 100    /* No Id */
-#define ROUTE_DISCONNECT   (ushort) 0xff  /* Not connected */
-#define ROUTE_INTERCONNECT (ushort) 0x40  /* Sub-net interconnect */
+#define NO_LINK            (short) 5   /* Link unattached */
+#define ROUTE_NO_ID        (short) 100 /* No Id */
+#define ROUTE_DISCONNECT   (ushort) 0xff       /* Not connected */
+#define ROUTE_INTERCONNECT (ushort) 0x40       /* Sub-net interconnect */
 
 
 #define SYNC_RUP         (ushort) 255
@@ -99,10 +99,9 @@ struct  ROUTE_STR {
 #define STATUS_RUP       (ushort) 249
 #define POWER_RUP        (ushort) 248
 
-#define HIGHEST_RUP      (ushort) 255   /* Set to Top one */
-#define LOWEST_RUP       (ushort) 248   /* Set to bottom one */
+#define HIGHEST_RUP      (ushort) 255  /* Set to Top one */
+#define LOWEST_RUP       (ushort) 248  /* Set to bottom one */
 
 #endif
 
 /*********** end of file ***********/
-
index 06860118cbc590bf3a8c8933dd2b63dfbf572de6..e6c2cdfd3a1fe8297e40c0248c4e5f147204c484 100644 (file)
@@ -37,7 +37,7 @@
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_rtahw_h_sccs = "@(#)rtahw.h  1.5" ;
+static char *_rio_rtahw_h_sccs = "@(#)rtahw.h  1.5";
 #endif
 #endif
 
@@ -58,12 +58,12 @@ static char *_rio_rtahw_h_sccs = "@(#)rtahw.h       1.5" ;
 ** Define the different types of modules we can have
 */
 enum module {
-    MOD_BLANK          = 0x0f,         /* Blank plate attached */
-    MOD_RS232DB25      = 0x00,         /* RS232 DB25 connector */
-    MOD_RS232RJ45      = 0x01,         /* RS232 RJ45 connector */
-    MOD_RS422DB25      = 0x02,         /* RS422 DB25 connector */
-    MOD_RS485DB25      = 0x03,         /* RS485 DB25 connector */
-    MOD_PARALLEL       = 0x04          /* Centronics parallel */
+       MOD_BLANK = 0x0f,       /* Blank plate attached */
+       MOD_RS232DB25 = 0x00,   /* RS232 DB25 connector */
+       MOD_RS232RJ45 = 0x01,   /* RS232 RJ45 connector */
+       MOD_RS422DB25 = 0x02,   /* RS422 DB25 connector */
+       MOD_RS485DB25 = 0x03,   /* RS485 DB25 connector */
+       MOD_PARALLEL = 0x04     /* Centronics parallel */
 };
 
 #define TYPE_HOST      0
index b9d2bc03d14b6122bfb1e4f1e0513a955ccce2d8..8d44fec91dd5212a1f588c4cc7752865a847d990 100644 (file)
 #endif
 
 #if defined( HOST ) || defined( INKERNEL )
-#define MAX_RUP          ((short) 16) 
+#define MAX_RUP          ((short) 16)
 #endif
 #ifdef RTA
 #define MAX_RUP          ((short) 1)
 #endif
 
-#define PKTS_PER_RUP     ((short) 2)     /* They are always used in pairs */
+#define PKTS_PER_RUP     ((short) 2)   /* They are always used in pairs */
 
 /*************************************************
  * Define all the  packet request stuff
  ************************************************/
-#define TX_RUP_INACTIVE          0        /* Nothing to transmit */
-#define TX_PACKET_READY          1        /* Transmit packet ready */
-#define TX_LOCK_RUP              2        /* Transmit side locked */
+#define TX_RUP_INACTIVE          0     /* Nothing to transmit */
+#define TX_PACKET_READY          1     /* Transmit packet ready */
+#define TX_LOCK_RUP              2     /* Transmit side locked */
 
-#define RX_RUP_INACTIVE          0        /* Nothing received */
-#define RX_PACKET_READY          1        /* Packet received */
+#define RX_RUP_INACTIVE          0     /* Nothing received */
+#define RX_PACKET_READY          1     /* Packet received */
 
-#define RUP_NO_OWNER             0xff     /* RUP not owned by any process */
+#define RUP_NO_OWNER             0xff  /* RUP not owned by any process */
 
 struct RUP {
-             PKT_ptr    txpkt;            /* Outgoing packet */
-             PKT_ptr    rxpkt;            /* Incoming packet */
-             WORD       link;             /* Which link to send down? */
-             BYTE       rup_dest_unit[2]; /* Destination unit */
-             WORD       handshake;        /* For handshaking */
-             WORD       timeout;          /* Timeout */
-             WORD       status;           /* Status */
-             WORD       txcontrol;        /* Transmit control */
-             WORD       rxcontrol;        /* Receive control */
-           };
+       PKT_ptr txpkt;          /* Outgoing packet */
+       PKT_ptr rxpkt;          /* Incoming packet */
+       WORD link;              /* Which link to send down? */
+       BYTE rup_dest_unit[2];  /* Destination unit */
+       WORD handshake;         /* For handshaking */
+       WORD timeout;           /* Timeout */
+       WORD status;            /* Status */
+       WORD txcontrol;         /* Transmit control */
+       WORD rxcontrol;         /* Receive control */
+};
+
 #endif
 
 /*********** end of file ***********/
-
index b4aafaff0d7801a6f99c86bc5c98867628be2dbf..56d828c63d28a525354f44eb48a17bb45ceea931 100644 (file)
@@ -39,7 +39,7 @@
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_rupstat_h_sccs = "@(#)rupstat.h      1.1" ;
+static char *_rio_rupstat_h_sccs = "@(#)rupstat.h      1.1";
 #endif
 #endif
 
@@ -48,4 +48,3 @@ static char *_rio_rupstat_h_sccs = "@(#)rupstat.h     1.1" ;
 #define    STATUS_TOPOLOGY    2
 
 #endif
-
index c1accb8cb62430ef507b1254d74fe2abc81fc970..31494054b21380875a89f42c557bb05c573cf09d 100644 (file)
 #define RX    FALSE
 
 
-typedef struct FREE_LIST FREE_LIST ;
-struct FREE_LIST   {
-                       FREE_LIST_ptr next ;
-                       FREE_LIST_ptr prev ;
-                   } ;
+typedef struct FREE_LIST FREE_LIST;
+struct FREE_LIST {
+       FREE_LIST_ptr next;
+       FREE_LIST_ptr prev;
+};
 
 
 #endif
 /*********** end of file ***********/
-
-
-
index deae48722a2176f67b0cdfad205914c4acd0893a..7a3dba35232390d5972b7c920d580f17c3cc5152 100644 (file)
 ** selftest on a booting RTA.
 */
 typedef struct {
-    short              magic;                  /* Identifies packet type */
-    int                        test;                   /* Test number, see below */
-    unsigned int       result;                 /* Result value */
-    unsigned int       dataIn;
-    unsigned int       dataOut;
-}selftestStruct;
+       short magic;            /* Identifies packet type */
+       int test;               /* Test number, see below */
+       unsigned int result;    /* Result value */
+       unsigned int dataIn;
+       unsigned int dataOut;
+} selftestStruct;
 
 /*
 ** The different tests are identified by the following data values.
 */
 enum test {
-    TESTS_COMPLETE     = 0x00,
-    MEMTEST_ADDR       = 0x01,
-    MEMTEST_BIT                = 0x02,
-    MEMTEST_FILL       = 0x03,
-    MEMTEST_DATABUS    = 0x04,
-    MEMTEST_ADDRBUS    = 0x05,
-    CD1400_INIT                = 0x10,
-    CD1400_LOOP                = 0x11,
-    CD1400_INTERRUPT    = 0x12
+       TESTS_COMPLETE = 0x00,
+       MEMTEST_ADDR = 0x01,
+       MEMTEST_BIT = 0x02,
+       MEMTEST_FILL = 0x03,
+       MEMTEST_DATABUS = 0x04,
+       MEMTEST_ADDRBUS = 0x05,
+       CD1400_INIT = 0x10,
+       CD1400_LOOP = 0x11,
+       CD1400_INTERRUPT = 0x12
 };
 
 enum result {
-    E_PORT             = 0x10,
-    E_TX               = 0x11,
-    E_RX               = 0x12,
-    E_EXCEPT           = 0x13,
-    E_COMPARE          = 0x14,
-    E_MODEM            = 0x15,
-    E_TIMEOUT          = 0x16,
-    E_INTERRUPT         = 0x17
+       E_PORT = 0x10,
+       E_TX = 0x11,
+       E_RX = 0x12,
+       E_EXCEPT = 0x13,
+       E_COMPARE = 0x14,
+       E_MODEM = 0x15,
+       E_TIMEOUT = 0x16,
+       E_INTERRUPT = 0x17
 };
-#endif /* _selftests_h_ */
+#endif                         /* _selftests_h_ */
index 72398d34205162b6f02079091d4060243c56b6db..1f12690f9d1f566fe9b2e359480c6073eac1c144 100644 (file)
@@ -42,4 +42,4 @@ extern int rio_bases[];
 extern int rio_limits[];
 extern int rio_vects[];
 
-#endif /* __rio_space_h__ */
+#endif                         /* __rio_space_h__ */
index fdc7313935761e62458bde1d1c4058462e3e4366..e1c6f1160dff6d57852c5b5de4857d534cf513e5 100644 (file)
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_sysmap_h_sccs = "@(#)sysmap.h        1.1" ;
+static char *_rio_sysmap_h_sccs = "@(#)sysmap.h        1.1";
 #endif
 #endif
 
-#define SYSTEM_MAP_LEN     64           /* Len of System Map array */
+#define SYSTEM_MAP_LEN     64  /* Len of System Map array */
 
 
-typedef struct SYS_MAP        SYS_MAP ;
-typedef struct SYS_MAP_LINK   SYS_MAP_LINK ;
+typedef struct SYS_MAP SYS_MAP;
+typedef struct SYS_MAP_LINK SYS_MAP_LINK;
 
 struct SYS_MAP_LINK {
-                        short id ;          /* Unit Id */
-                        short link ;        /* Id's Link */
-                        short been_here ;   /* Used by map_gen */
-                    } ;
+       short id;               /* Unit Id */
+       short link;             /* Id's Link */
+       short been_here;        /* Used by map_gen */
+};
 
 struct SYS_MAP {
-                   char         serial_num[4] ;
-                   SYS_MAP_LINK link[4] ;
-               } ;
+       char serial_num[4];
+       SYS_MAP_LINK link[4];
+};
 
 
 /*********** end of file ***********/
-
index 11b31330c9014e92fefd8f2912a280a8d5586ac6..a8b5be3ca9bfa272b444619d663d393e50310182 100644 (file)
 
 #ifndef lint
 #ifdef SCCS_LABELS
-static char *_rio_defaults_h_sccs = "@(#)timeouts.h    1.3" ;
+static char *_rio_defaults_h_sccs = "@(#)timeouts.h    1.3";
 #endif
 #endif
 
-#define MILLISECOND           (int) (1000/64)   /* 15.625 low ticks */
-#define SECOND                (int) 15625       /* Low priority ticks */
+#define MILLISECOND           (int) (1000/64)  /* 15.625 low ticks */
+#define SECOND                (int) 15625      /* Low priority ticks */
 
 #define TX_TIMEOUT          (int) (200 * MILLISECOND)
 
 
 /*********** end of file ***********/
-
index 255c40d463a669d45e0ed8ac3d86f63bc21c939c..d15a11dc4f7305bcda9fb2613316401cd27ff216 100644 (file)
@@ -40,10 +40,9 @@ static char *_top_h_sccs_ = "@(#)top.h       1.2";
 /*
 ** Topology information
 */
-struct Top
-{
-    uchar Unit;
-    uchar Link;
+struct Top {
+       uchar Unit;
+       uchar Link;
 };
 
-#endif /* __rio_top_h__ */
+#endif                         /* __rio_top_h__ */
index 2cb9dd693fa17f4ed1f66a5bb9ac47081b731ea7..185b889e151033713169a06be0bd6f1a5b8883c8 100644 (file)
@@ -45,11 +45,11 @@ static char *_typdef_h_sccs_ = "@(#)typdef.h        1.2";
 ** These types are ONLY to be used for refering to data structures
 ** on the RIO Host card!
 */
-typedef        volatile unsigned char  BYTE;
-typedef volatile unsigned short        WORD;
-typedef volatile unsigned int  DWORD;
-typedef        volatile unsigned short RIOP;
-typedef        volatile short          NUMBER;
+typedef volatile unsigned char BYTE;
+typedef volatile unsigned short WORD;
+typedef volatile unsigned int DWORD;
+typedef volatile unsigned short RIOP;
+typedef volatile short NUMBER;
 
 
 /*
@@ -59,13 +59,13 @@ typedef     volatile short          NUMBER;
 ** are here only to make the source compile.
 */
 /* typedef unsigned int        uint; */
-typedef unsigned long  ulong_t;
-typedef unsigned short ushort_t;
-typedef unsigned char  uchar_t;
-typedef unsigned char  queue_t;
-typedef unsigned char  mblk_t;
-typedef        unsigned int    paddr_t;
-typedef unsigned char   uchar;
+typedef unsigned long ulong_t;
+typedef unsigned short ushort_t;
+typedef unsigned char uchar_t;
+typedef unsigned char queue_t;
+typedef unsigned char mblk_t;
+typedef unsigned int paddr_t;
+typedef unsigned char uchar;
 
 #define        TPNULL  ((ushort)(0x8000))
 
@@ -73,10 +73,10 @@ typedef unsigned char   uchar;
 /*
 ** RIO structures defined in other include files.
 */
-typedef struct PKT             PKT;
-typedef struct LPB             LPB;
-typedef struct RUP             RUP;
-typedef struct Port            Port;
-typedef struct DpRam           DpRam;
+typedef struct PKT PKT;
+typedef struct LPB LPB;
+typedef struct RUP RUP;
+typedef struct Port Port;
+typedef struct DpRam DpRam;
 
-#endif /* __rio_typdef_h__ */
+#endif                         /* __rio_typdef_h__ */
index eddf86278abca08e77ec8d45282baad08ba5069a..a126c7cabac63e357e83e2a7abe340d9a9281d38 100644 (file)
@@ -41,16 +41,15 @@ static char *_unixrup_h_sccs_ = "@(#)unixrup.h      1.2";
 **    UnixRup data structure. This contains pointers to actual RUPs on the
 **    host card, and all the command/boot control stuff.
 */
-struct    UnixRup
-{
-    struct CmdBlk    *CmdsWaitingP;    /* Commands waiting to be done */
-    struct CmdBlk    *CmdPendingP;     /* The command currently being sent */
-    struct RUP       *RupP;            /* the Rup to send it to */
-    uint             Id;               /* Id number */
-    uint             BaseSysPort;      /* SysPort of first tty on this RTA */
-    uint             ModTypes;         /* Modules on this RTA */
-    spinlock_t      RupLock;           /* Lock structure for MPX */
-/*    struct lockb     RupLock;        */      /* Lock structure for MPX */
+struct UnixRup {
+       struct CmdBlk *CmdsWaitingP;    /* Commands waiting to be done */
+       struct CmdBlk *CmdPendingP;     /* The command currently being sent */
+       struct RUP *RupP;       /* the Rup to send it to */
+       uint Id;                /* Id number */
+       uint BaseSysPort;       /* SysPort of first tty on this RTA */
+       uint ModTypes;          /* Modules on this RTA */
+       spinlock_t RupLock;     /* Lock structure for MPX */
+       /*    struct lockb     RupLock; *//* Lock structure for MPX */
 };
 
-#endif /* __rio_unixrup_h__ */
+#endif                         /* __rio_unixrup_h__ */
index a7f099fb7dfed7b86d3d386baa85018215d07b35..7cac6d05d72353da0c69c883d1806e59cc50aa8e 100644 (file)
  *      1.11a   Daniele Bellucci: Audit create_proc_read_entry in rtc_init
  *     1.12    Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer
  *             CONFIG_HPET_EMULATE_RTC
- *
+ *     1.12ac  Alan Cox: Allow read access to the day of week register
  */
 
-#define RTC_VERSION            "1.12"
+#define RTC_VERSION            "1.12ac"
 
 #define RTC_IO_EXTENT  0x8
 
@@ -1250,9 +1250,9 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
 
        /*
         * Only the values that we read from the RTC are set. We leave
-        * tm_wday, tm_yday and tm_isdst untouched. Even though the
-        * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
-        * by the RTC when initially set to a non-zero value.
+        * tm_wday, tm_yday and tm_isdst untouched. Note that while the
+        * RTC has RTC_DAY_OF_WEEK, we should usually ignore it, as it is
+        * only updated by the RTC when initially set to a non-zero value.
         */
        spin_lock_irq(&rtc_lock);
        rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS);
@@ -1261,6 +1261,9 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
        rtc_tm->tm_mday = CMOS_READ(RTC_DAY_OF_MONTH);
        rtc_tm->tm_mon = CMOS_READ(RTC_MONTH);
        rtc_tm->tm_year = CMOS_READ(RTC_YEAR);
+       /* Only set from 2.6.16 onwards */
+       rtc_tm->tm_wday = CMOS_READ(RTC_DAY_OF_WEEK);
+
 #ifdef CONFIG_MACH_DECSTATION
        real_year = CMOS_READ(RTC_DEC_YEAR);
 #endif
@@ -1275,6 +1278,7 @@ void rtc_get_rtc_time(struct rtc_time *rtc_tm)
                BCD_TO_BIN(rtc_tm->tm_mday);
                BCD_TO_BIN(rtc_tm->tm_mon);
                BCD_TO_BIN(rtc_tm->tm_year);
+               BCD_TO_BIN(rtc_tm->tm_wday);
        }
 
 #ifdef CONFIG_MACH_DECSTATION
index 51810f72f1a92def836878e99c6e64967a8f0c88..93998f5baff576d9a68dcbd4077aa1ad37be1c95 100644 (file)
@@ -399,7 +399,7 @@ struct scc_port {
                __asm__ __volatile__ ( "tstb %0" : : "g" (*_scc_del) : "cc" );\
     } while (0)
 
-extern unsigned char scc_shadow[2][16];
+static unsigned char scc_shadow[2][16];
 
 /* The following functions should relax the somehow complicated
  * register access of the SCC. _SCCwrite() stores all written values
index 79c81def4104f207b7a4ff9d7efc21ef1b6720ea..07c9be6a6bbf4ceebbb9103e9f3b6b2fc1f99657 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: synclink_gt.c,v 4.20 2005/11/08 19:51:55 paulkf Exp $
+ * $Id: synclink_gt.c,v 4.22 2006/01/09 20:16:06 paulkf Exp $
  *
  * Device driver for Microgate SyncLink GT serial adapters.
  *
@@ -92,7 +92,7 @@
  * module identification
  */
 static char *driver_name     = "SyncLink GT";
-static char *driver_version  = "$Revision: 4.20 $";
+static char *driver_version  = "$Revision: 4.22 $";
 static char *tty_driver_name = "synclink_gt";
 static char *tty_dev_prefix  = "ttySLG";
 MODULE_LICENSE("GPL");
@@ -288,7 +288,6 @@ struct slgt_info {
 
        unsigned char __iomem * reg_addr;  /* memory mapped registers address */
        u32 phys_reg_addr;
-       u32 reg_offset;
        int reg_addr_requested;
 
        MGSL_PARAMS params;       /* communications parameters */
@@ -2976,14 +2975,13 @@ static int claim_resources(struct slgt_info *info)
        else
                info->reg_addr_requested = 1;
 
-       info->reg_addr = ioremap(info->phys_reg_addr, PAGE_SIZE);
+       info->reg_addr = ioremap(info->phys_reg_addr, SLGT_REG_SIZE);
        if (!info->reg_addr) {
                DBGERR(("%s cant map device registers, addr=%08X\n",
                        info->device_name, info->phys_reg_addr));
                info->init_error = DiagStatus_CantAssignPciResources;
                goto errout;
        }
-       info->reg_addr += info->reg_offset;
        return 0;
 
 errout:
@@ -3004,7 +3002,7 @@ static void release_resources(struct slgt_info *info)
        }
 
        if (info->reg_addr) {
-               iounmap(info->reg_addr - info->reg_offset);
+               iounmap(info->reg_addr);
                info->reg_addr = NULL;
        }
 }
@@ -3108,12 +3106,6 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev
                info->irq_level = pdev->irq;
                info->phys_reg_addr = pci_resource_start(pdev,0);
 
-               /* veremap works on page boundaries
-                * map full page starting at the page boundary
-                */
-               info->reg_offset    = info->phys_reg_addr & (PAGE_SIZE-1);
-               info->phys_reg_addr &= ~(PAGE_SIZE-1);
-
                info->bus_type = MGSL_BUS_TYPE_PCI;
                info->irq_flags = SA_SHIRQ;
 
index 12167c04fa4c00b44475f536ec53e7551c6b4d4f..bc56df8a34740438f7040ec5b299727f1f5653c0 100644 (file)
@@ -211,7 +211,7 @@ static int tlclk_open(struct inode *inode, struct file *filp)
        result = request_irq(telclk_interrupt, &tlclk_interrupt,
                             SA_INTERRUPT, "telco_clock", tlclk_interrupt);
        if (result == -EBUSY) {
-               printk(KERN_ERR "telco_clock: Interrupt can't be reserved!\n");
+               printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n");
                return -EBUSY;
        }
        inb(TLCLK_REG6);        /* Clear interrupt events */
@@ -741,7 +741,7 @@ static int __init tlclk_init(void)
 
        ret = register_chrdev(tlclk_major, "telco_clock", &tlclk_fops);
        if (ret < 0) {
-               printk(KERN_ERR "telco_clock: can't get major! %d\n", tlclk_major);
+               printk(KERN_ERR "tlclk: can't get major %d.\n", tlclk_major);
                return ret;
        }
        alarm_events = kzalloc( sizeof(struct tlclk_alarms), GFP_KERNEL);
@@ -750,7 +750,7 @@ static int __init tlclk_init(void)
 
        /* Read telecom clock IRQ number (Set by BIOS) */
        if (!request_region(TLCLK_BASE, 8, "telco_clock")) {
-               printk(KERN_ERR "tlclk: request_region failed! 0x%X\n",
+               printk(KERN_ERR "tlclk: request_region 0x%X failed.\n",
                        TLCLK_BASE);
                ret = -EBUSY;
                goto out2;
@@ -758,7 +758,7 @@ static int __init tlclk_init(void)
        telclk_interrupt = (inb(TLCLK_REG7) & 0x0f);
 
        if (0x0F == telclk_interrupt ) { /* not MCPBL0010 ? */
-               printk(KERN_ERR "telclk_interrup = 0x%x non-mcpbl0010 hw\n",
+               printk(KERN_ERR "telclk_interrup = 0x%x non-mcpbl0010 hw.\n",
                        telclk_interrupt);
                ret = -ENXIO;
                goto out3;
@@ -768,7 +768,7 @@ static int __init tlclk_init(void)
 
        ret = misc_register(&tlclk_miscdev);
        if (ret < 0) {
-               printk(KERN_ERR " misc_register retruns %d\n", ret);
+               printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret);
                ret = -EBUSY;
                goto out3;
        }
@@ -776,8 +776,7 @@ static int __init tlclk_init(void)
        tlclk_device = platform_device_register_simple("telco_clock",
                                -1, NULL, 0);
        if (!tlclk_device) {
-               printk(KERN_ERR " platform_device_register retruns 0x%X\n",
-                       (unsigned int) tlclk_device);
+               printk(KERN_ERR "tlclk: platform_device_register failed.\n");
                ret = -EBUSY;
                goto out4;
        }
@@ -785,7 +784,7 @@ static int __init tlclk_init(void)
        ret = sysfs_create_group(&tlclk_device->dev.kobj,
                        &tlclk_attribute_group);
        if (ret) {
-               printk(KERN_ERR "failed to create sysfs device attributes\n");
+               printk(KERN_ERR "tlclk: failed to create sysfs device attributes.\n");
                sysfs_remove_group(&tlclk_device->dev.kobj,
                        &tlclk_attribute_group);
                goto out5;
index 1eda82b31a61e8d890d551ead0488fdb675993eb..eb8b5be4e2494c318e9f4af4195d8cd0b63cede7 100644 (file)
@@ -312,7 +312,7 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size)
 
 int tty_buffer_request_room(struct tty_struct *tty, size_t size)
 {
-       struct tty_buffer *b = tty->buf.head, *n;
+       struct tty_buffer *b = tty->buf.tail, *n;
        int left = 0;
 
        /* OPTIMISATION: We could keep a per tty "zero" sized buffer to
@@ -326,7 +326,6 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
        n = tty_buffer_find(tty, size);
        if(n == NULL)
                return left;
-       n->next = b;
        if(b != NULL)
                b->next = n;
        else
@@ -2751,6 +2750,8 @@ static void flush_to_ldisc(void *private_)
        spin_lock_irqsave(&tty->read_lock, flags);
        while((tbuf = tty->buf.head) != NULL) {
                tty->buf.head = tbuf->next;
+               if (tty->buf.head == NULL)
+                       tty->buf.tail = NULL;
                spin_unlock_irqrestore(&tty->read_lock, flags);
                /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */
                disc->receive_buf(tty, tbuf->char_buf_ptr,
@@ -2759,7 +2760,6 @@ static void flush_to_ldisc(void *private_)
                spin_lock_irqsave(&tty->read_lock, flags);
                tty_buffer_free(tty, tbuf);
        }
-       tty->buf.tail = NULL;
        spin_unlock_irqrestore(&tty->read_lock, flags);
 out:
        tty_ldisc_deref(disc);
index cb82ebf4cb0787b8fcd7e28e24118b1c334be725..faee5e7acaf7ae7707847bcb9f2ff8f044f41279 100644 (file)
@@ -131,7 +131,7 @@ static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp);
 
 static struct tty_driver *viotty_driver;
 
-void hvlog(char *fmt, ...)
+static void hvlog(char *fmt, ...)
 {
        int i;
        unsigned long flags;
@@ -147,7 +147,7 @@ void hvlog(char *fmt, ...)
        spin_unlock_irqrestore(&consoleloglock, flags);
 }
 
-void hvlogOutput(const char *buf, int count)
+static void hvlogOutput(const char *buf, int count)
 {
        unsigned long flags;
        int begin;
@@ -904,6 +904,7 @@ static void vioHandleData(struct HvLpEvent *event)
        struct viocharlpevent *cevent = (struct viocharlpevent *)event;
        struct port_info *pi;
        int index;
+       int num_pushed;
        u8 port = cevent->virtual_device;
 
        if (port >= VTTY_PORTS) {
@@ -964,6 +965,7 @@ static void vioHandleData(struct HvLpEvent *event)
         * functionality will only work if built into the kernel and
         * then only if sysrq is enabled through the proc filesystem.
         */
+       num_pushed = 0;
        for (index = 0; index < cevent->len; index++) {
 #ifdef CONFIG_MAGIC_SYSRQ
                if (sysrq_enabled) {
@@ -997,11 +999,10 @@ static void vioHandleData(struct HvLpEvent *event)
                        printk(VIOCONS_KERN_WARN "input buffer overflow!\n");
                        break;
                }
+               num_pushed++;
        }
 
-       /* if cevent->len == 0 then no data was added to the buffer and flip.count == 0 */
-       if (tty->flip.count)
-               /* The next call resets flip.count when the data is flushed. */
+       if (num_pushed)
                tty_flip_buffer_push(tty);
 }
 
index bda5bce681b6bbdf0962c39e50cc3e8b4c3e1877..343379f23a53cf432b98118c00e095b497aa6e6c 100644 (file)
  *   v0.01 release to linux-ia64@linuxia64.org
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/init.h>
-#include <linux/sched.h>               /* for capable() */
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/string.h>
index f7490a015d18a667e979cb68e0654d6a1e49c370..745979f33dc2e2cf3e3a9bbc1909b50897cb6c04 100644 (file)
@@ -154,10 +154,12 @@ struct input_event_compat {
        __s32 value;
 };
 
+/* Note to the author of this code: did it ever occur to
+   you why the ifdefs are needed? Think about it again. -AK */
 #ifdef CONFIG_X86_64
-#  define COMPAT_TEST test_thread_flag(TIF_IA32)
+#  define COMPAT_TEST is_compat_task()
 #elif defined(CONFIG_IA64)
-#  define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current))
+#  define COMPAT_TEST IS_IA32_PROCESS(task_pt_regs(current))
 #elif defined(CONFIG_S390)
 #  define COMPAT_TEST test_thread_flag(TIF_31BIT)
 #elif defined(CONFIG_MIPS)
index 8558a99f6635a653287563d7e31557cdf04080b5..ec55a29fc861047dcd5ff11100a8fb797faaec8e 100644 (file)
@@ -64,8 +64,8 @@ static irqreturn_t amijoy_interrupt(int irq, void *dummy, struct pt_regs *fp)
                if (amijoy[i]) {
 
                        switch (i) {
-                               case 0: data = ~custom.joy0dat; button = (~ciaa.pra >> 6) & 1; break;
-                               case 1: data = ~custom.joy1dat; button = (~ciaa.pra >> 7) & 1; break;
+                               case 0: data = ~amiga_custom.joy0dat; button = (~ciaa.pra >> 6) & 1; break;
+                               case 1: data = ~amiga_custom.joy1dat; button = (~ciaa.pra >> 7) & 1; break;
                        }
 
                        input_regs(amijoy_dev[i], fp);
index d13d4c8fe3c5b20111a0118bc5b32d34f16ce25d..c8b2cc9f184c7355b1004d913cc5c0f7ace57c29 100644 (file)
@@ -41,7 +41,7 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp)
        unsigned short joy0dat, potgor;
        int nx, ny, dx, dy;
 
-       joy0dat = custom.joy0dat;
+       joy0dat = amiga_custom.joy0dat;
 
        nx = joy0dat & 0xff;
        ny = joy0dat >> 8;
@@ -57,7 +57,7 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy, struct pt_regs *fp)
        amimouse_lastx = nx;
        amimouse_lasty = ny;
 
-       potgor = custom.potgor;
+       potgor = amiga_custom.potgor;
 
        input_regs(amimouse_dev, fp);
 
@@ -77,7 +77,7 @@ static int amimouse_open(struct input_dev *dev)
 {
        unsigned short joy0dat;
 
-       joy0dat = custom.joy0dat;
+       joy0dat = amiga_custom.joy0dat;
 
        amimouse_lastx = joy0dat & 0xff;
        amimouse_lasty = joy0dat >> 8;
index 71aeb912ec61e455d4db26ae6e8091a42aadfa53..d56d400b6aaa52644fe610ef5042b00cddfa538e 100644 (file)
@@ -239,7 +239,7 @@ static int adb_iop_write(struct adb_request *req)
 
        local_irq_save(flags);
 
-       req->next = 0;
+       req->next = NULL;
        req->sent = 0;
        req->complete = 0;
        req->reply_len = 0;
index e9a159ad3022cfebe01928c3fd7c3581565dce74..2a2ffe060169a5f96d9679466b745f8341ee5397 100644 (file)
@@ -260,7 +260,7 @@ static int macii_write(struct adb_request *req)
                return -EINVAL;
        }
        
-       req->next = 0;
+       req->next = NULL;
        req->sent = 0;
        req->complete = 0;
        req->reply_len = 0;
@@ -295,7 +295,7 @@ static void macii_poll(void)
        unsigned long flags;
 
        local_irq_save(flags);
-       if (via[IFR] & SR_INT) macii_interrupt(0, 0, 0);
+       if (via[IFR] & SR_INT) macii_interrupt(0, NULL, NULL);
        local_irq_restore(flags);
 }
 
index a1966975d58fc6af85a702a36fcc4cc4ef3b6ac6..0129fcc3b183b050cd797910b9571cb2d9dccb5c 100644 (file)
@@ -294,6 +294,24 @@ static void maciisi_sync(struct adb_request *req)
                printk(KERN_ERR "maciisi_send_request: poll timed out!\n");
 }
 
+int
+maciisi_request(struct adb_request *req, void (*done)(struct adb_request *),
+           int nbytes, ...)
+{
+       va_list list;
+       int i;
+
+       req->nbytes = nbytes;
+       req->done = done;
+       req->reply_expected = 0;
+       va_start(list, nbytes);
+       for (i = 0; i < nbytes; i++)
+               req->data[i++] = va_arg(list, int);
+       va_end(list);
+
+       return maciisi_send_request(req, 1);
+}
+
 /* Enqueue a request, and run the queue if possible */
 static int
 maciisi_write(struct adb_request* req)
@@ -308,7 +326,7 @@ maciisi_write(struct adb_request* req)
                req->complete = 1;
                return -EINVAL;
        }
-       req->next = 0;
+       req->next = NULL;
        req->sent = 0;
        req->complete = 0;
        req->reply_len = 0;
@@ -403,7 +421,7 @@ maciisi_poll(void)
 
        local_irq_save(flags);
        if (via[IFR] & SR_INT) {
-               maciisi_interrupt(0, 0, 0);
+               maciisi_interrupt(0, NULL, NULL);
        }
        else /* avoid calling this function too quickly in a loop */
                udelay(ADB_DELAY);
index 6f80d76ac17c619b5aea4406140eae094cdf6a7b..f08e52f2107b97ef0bac9d10e52b92ba677f71b4 100644 (file)
@@ -493,7 +493,7 @@ pmu_queue_request(struct adb_request *req)
                return -EINVAL;
        }
 
-       req->next = 0;
+       req->next = NULL;
        req->sent = 0;
        req->complete = 0;
        local_irq_save(flags);
@@ -717,7 +717,7 @@ pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs)
                                printk(KERN_ERR "PMU: extra ADB reply\n");
                                return;
                        }
-                       req_awaiting_reply = 0;
+                       req_awaiting_reply = NULL;
                        if (len <= 2)
                                req->reply_len = 0;
                        else {
index 0302723fa21ff724ce5b7ead17d1c717318e6d19..1778104e106cf4b331b44e09da51dd02aaf415fc 100644 (file)
@@ -1238,6 +1238,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
        mdk_rdev_t *same_pdev;
        char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];
        struct kobject *ko;
+       char *s;
 
        if (rdev->mddev) {
                MD_BUG();
@@ -1277,6 +1278,8 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
        bdevname(rdev->bdev,b);
        if (kobject_set_name(&rdev->kobj, "dev-%s", b) < 0)
                return -ENOMEM;
+       while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
+               *s = '!';
                        
        list_add(&rdev->same_set, &mddev->disks);
        rdev->mddev = mddev;
index 2899d34e5f7e3249c8be04ea941d2be7bb9af327..04c1938b9c918f9330c27627f8dde1a7e21c3696 100644 (file)
@@ -109,10 +109,9 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
        struct page *pg;
        int i;
 
-       sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL);
+       sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
        if (NULL == sglist)
                return NULL;
-       memset(sglist,0,sizeof(struct scatterlist)*nr_pages);
        for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
                pg = vmalloc_to_page(virt);
                if (NULL == pg)
@@ -306,15 +305,13 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
        struct saa7146_dev *dev;
        int err = -ENOMEM;
 
-       dev = kmalloc(sizeof(struct saa7146_dev), GFP_KERNEL);
+       /* clear out mem for sure */
+       dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL);
        if (!dev) {
                ERR(("out of memory.\n"));
                goto out;
        }
 
-       /* clear out mem for sure */
-       memset(dev, 0x0, sizeof(struct saa7146_dev));
-
        DEB_EE(("pci:%p\n",pci));
 
        err = pci_enable_device(pci);
index b614612be7b439252c97451ced9e9de34a93609e..f8cf73ed49ad683e62119b34de9f5a857d44549d 100644 (file)
@@ -239,13 +239,12 @@ static int fops_open(struct inode *inode, struct file *file)
        }
 
        /* allocate per open data */
-       fh = kmalloc(sizeof(*fh),GFP_KERNEL);
+       fh = kzalloc(sizeof(*fh),GFP_KERNEL);
        if (NULL == fh) {
                DEB_S(("cannot allocate memory for per open data.\n"));
                result = -ENOMEM;
                goto out;
        }
-       memset(fh,0,sizeof(*fh));
 
        file->private_data = fh;
        fh->dev = dev;
@@ -464,12 +463,11 @@ static struct video_device device_template =
 
 int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
 {
-       struct saa7146_vv *vv = kmalloc (sizeof(struct saa7146_vv),GFP_KERNEL);
+       struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL);
        if( NULL == vv ) {
                ERR(("out of memory. aborting.\n"));
                return -1;
        }
-       memset(vv, 0x0, sizeof(*vv));
 
        DEB_EE(("dev:%p\n",dev));
 
index 123ed96f6faa54d4851c6e3c3171735dc9a01bd7..56ba52470676821070a88050b43c35d634f3d209 100644 (file)
@@ -220,20 +220,18 @@ EXPORT_SYMBOL(flexcop_reset_block_300);
 struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len)
 {
        void *bus;
-       struct flexcop_device *fc = kmalloc(sizeof(struct flexcop_device), GFP_KERNEL);
+       struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), GFP_KERNEL);
        if (!fc) {
                err("no memory");
                return NULL;
        }
-       memset(fc, 0, sizeof(struct flexcop_device));
 
-       bus = kmalloc(bus_specific_len, GFP_KERNEL);
+       bus = kzalloc(bus_specific_len, GFP_KERNEL);
        if (!bus) {
                err("no memory");
                kfree(fc);
                return NULL;
        }
-       memset(bus, 0, bus_specific_len);
 
        fc->bus_specific = bus;
 
index 01b4e0aac0491fc0620414f84f1207263d9a0f1e..f65f64b00ff342aa5c0140198e13be55db99ff2b 100644 (file)
@@ -786,10 +786,9 @@ static int dvb_bt8xx_probe(struct device *dev)
        struct pci_dev* bttv_pci_dev;
        int ret;
 
-       if (!(card = kmalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL)))
+       if (!(card = kzalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL)))
                return -ENOMEM;
 
-       memset(card, 0, sizeof(*card));
        init_MUTEX(&card->lock);
        card->bttv_nr = sub->core->nr;
        strncpy(card->card_name, sub->core->name, sizeof(sub->core->name));
index 4bb779aeff6af804f3682fca089b5e075add7f18..00347a750681942db7775769de7f7f2cf8f3eea3 100644 (file)
@@ -1649,21 +1649,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
                return -EINVAL;
 
        /* initialise the system data */
-       if ((ca =
-            (struct dvb_ca_private *) kmalloc(sizeof(struct dvb_ca_private),
-                                              GFP_KERNEL)) == NULL) {
+       if ((ca = kzalloc(sizeof(struct dvb_ca_private), GFP_KERNEL)) == NULL) {
                ret = -ENOMEM;
                goto error;
        }
-       memset(ca, 0, sizeof(struct dvb_ca_private));
        ca->pub = pubca;
        ca->flags = flags;
        ca->slot_count = slot_count;
-       if ((ca->slot_info = kmalloc(sizeof(struct dvb_ca_slot) * slot_count, GFP_KERNEL)) == NULL) {
+       if ((ca->slot_info = kcalloc(slot_count, sizeof(struct dvb_ca_slot), GFP_KERNEL)) == NULL) {
                ret = -ENOMEM;
                goto error;
        }
-       memset(ca->slot_info, 0, sizeof(struct dvb_ca_slot) * slot_count);
        init_waitqueue_head(&ca->wait_queue);
        ca->thread_pid = 0;
        init_waitqueue_head(&ca->thread_queue);
index 4a08c4ab67309190b07e8bb1491d12fdd695b8cd..771f32d889e6261de8b8c77d10fad85b55da20a4 100644 (file)
@@ -1024,13 +1024,12 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
        if (down_interruptible (&frontend_mutex))
                return -ERESTARTSYS;
 
-       fe->frontend_priv = kmalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL);
+       fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL);
        if (fe->frontend_priv == NULL) {
                up(&frontend_mutex);
                return -ENOMEM;
        }
        fepriv = fe->frontend_priv;
-       memset(fe->frontend_priv, 0, sizeof(struct dvb_frontend_private));
 
        init_MUTEX (&fepriv->sem);
        init_waitqueue_head (&fepriv->wait_queue);
index 358ed153865ff1c6731ca6108978b5d83e19c0f7..18d169836c9ce4116bd4a679e93d9a22eeab54a6 100644 (file)
@@ -253,6 +253,26 @@ static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
        return 0;
 }
 
+static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
+{      /* used in both lgz201 and th7579 */
+       static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x39 };
+       static u8 reset []         = { RESET,      0x80 };
+       static u8 adc_ctl_1_cfg [] = { ADC_CTL_1,  0x40 };
+       static u8 agc_cfg []       = { AGC_TARGET, 0x24, 0x20 };
+       static u8 gpp_ctl_cfg []   = { GPP_CTL,    0x33 };
+       static u8 capt_range_cfg[] = { CAPT_RANGE, 0x32 };
+
+       mt352_write(fe, clock_config,   sizeof(clock_config));
+       udelay(200);
+       mt352_write(fe, reset,          sizeof(reset));
+       mt352_write(fe, adc_ctl_1_cfg,  sizeof(adc_ctl_1_cfg));
+
+       mt352_write(fe, agc_cfg,        sizeof(agc_cfg));
+       mt352_write(fe, gpp_ctl_cfg,    sizeof(gpp_ctl_cfg));
+       mt352_write(fe, capt_range_cfg, sizeof(capt_range_cfg));
+       return 0;
+}
+
 struct cx22702_config cxusb_cx22702_config = {
        .demod_address = 0x63,
 
@@ -274,6 +294,13 @@ struct mt352_config cxusb_dee1601_config = {
        .pll_set       = dvb_usb_pll_set,
 };
 
+struct mt352_config cxusb_mt352_config = {
+       /* used in both lgz201 and th7579 */
+       .demod_address = 0x0f,
+       .demod_init    = cxusb_mt352_demod_init,
+       .pll_set       = dvb_usb_pll_set,
+};
+
 /* Callbacks for DVB USB */
 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d)
 {
@@ -302,6 +329,20 @@ static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d)
        return 0;
 }
 
+static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d)
+{
+       d->pll_addr = 0x61;
+       d->pll_desc = &dvb_pll_lg_z201;
+       return 0;
+}
+
+static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d)
+{
+       d->pll_addr = 0x60;
+       d->pll_desc = &dvb_pll_thomson_dtt7579;
+       return 0;
+}
+
 static int cxusb_cx22702_frontend_attach(struct dvb_usb_device *d)
 {
        u8 b;
@@ -329,6 +370,19 @@ static int cxusb_lgdt330x_frontend_attach(struct dvb_usb_device *d)
        return -EIO;
 }
 
+static int cxusb_mt352_frontend_attach(struct dvb_usb_device *d)
+{      /* used in both lgz201 and th7579 */
+       if (usb_set_interface(d->udev,0,0) < 0)
+               err("set interface failed");
+
+       cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0);
+
+       if ((d->fe = mt352_attach(&cxusb_mt352_config, &d->i2c_adap)) != NULL)
+               return 0;
+
+       return -EIO;
+}
+
 static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d)
 {
        if (usb_set_interface(d->udev,0,0) < 0)
@@ -370,13 +424,17 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const
 static struct dvb_usb_properties cxusb_medion_properties;
 static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties;
 static struct dvb_usb_properties cxusb_bluebird_dee1601_properties;
+static struct dvb_usb_properties cxusb_bluebird_lgz201_properties;
+static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties;
 
 static int cxusb_probe(struct usb_interface *intf,
                const struct usb_device_id *id)
 {
        if (dvb_usb_device_init(intf,&cxusb_medion_properties,THIS_MODULE,NULL) == 0 ||
                dvb_usb_device_init(intf,&cxusb_bluebird_lgh064f_properties,THIS_MODULE,NULL) == 0 ||
-               dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0) {
+               dvb_usb_device_init(intf,&cxusb_bluebird_dee1601_properties,THIS_MODULE,NULL) == 0 ||
+               dvb_usb_device_init(intf,&cxusb_bluebird_lgz201_properties,THIS_MODULE,NULL) == 0 ||
+               dvb_usb_device_init(intf,&cxusb_bluebird_dtt7579_properties,THIS_MODULE,NULL) == 0) {
                return 0;
        }
 
@@ -389,6 +447,12 @@ static struct usb_device_id cxusb_table [] = {
                { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
                { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_COLD) },
                { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_WARM) },
+               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) },
+               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) },
+               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) },
+               { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) },
+               { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD) },
+               { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM) },
                {}              /* Terminating entry */
 };
 MODULE_DEVICE_TABLE (usb, cxusb_table);
@@ -505,12 +569,96 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
                }
        },
 
-       .num_device_descs = 1,
+       .num_device_descs = 2,
        .devices = {
                {   "DViCO FusionHDTV DVB-T Dual USB",
                        { &cxusb_table[3], NULL },
                        { &cxusb_table[4], NULL },
                },
+               {   "DigitalNow DVB-T Dual USB",
+                       { &cxusb_table[9],  NULL },
+                       { &cxusb_table[10], NULL },
+               },
+       }
+};
+
+static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = {
+       .caps = DVB_USB_IS_AN_I2C_ADAPTER,
+
+       .usb_ctrl          = DEVICE_SPECIFIC,
+       .firmware          = "dvb-usb-bluebird-01.fw",
+       .download_firmware = bluebird_patch_dvico_firmware_download,
+       /* use usb alt setting 0 for EP4 transfer (dvb-t),
+          use usb alt setting 7 for EP2 transfer (atsc) */
+
+       .size_of_priv     = sizeof(struct cxusb_state),
+
+       .streaming_ctrl   = cxusb_streaming_ctrl,
+       .power_ctrl       = cxusb_power_ctrl,
+       .frontend_attach  = cxusb_mt352_frontend_attach,
+       .tuner_attach     = cxusb_lgz201_tuner_attach,
+
+       .i2c_algo         = &cxusb_i2c_algo,
+
+       .generic_bulk_ctrl_endpoint = 0x01,
+       /* parameter for the MPEG2-data transfer */
+       .urb = {
+               .type = DVB_USB_BULK,
+               .count = 5,
+               .endpoint = 0x04,
+               .u = {
+                       .bulk = {
+                               .buffersize = 8192,
+                       }
+               }
+       },
+
+       .num_device_descs = 1,
+       .devices = {
+               {   "DViCO FusionHDTV DVB-T USB (LGZ201)",
+                       { &cxusb_table[5], NULL },
+                       { &cxusb_table[6], NULL },
+               },
+       }
+};
+
+static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = {
+       .caps = DVB_USB_IS_AN_I2C_ADAPTER,
+
+       .usb_ctrl          = DEVICE_SPECIFIC,
+       .firmware          = "dvb-usb-bluebird-01.fw",
+       .download_firmware = bluebird_patch_dvico_firmware_download,
+       /* use usb alt setting 0 for EP4 transfer (dvb-t),
+          use usb alt setting 7 for EP2 transfer (atsc) */
+
+       .size_of_priv     = sizeof(struct cxusb_state),
+
+       .streaming_ctrl   = cxusb_streaming_ctrl,
+       .power_ctrl       = cxusb_power_ctrl,
+       .frontend_attach  = cxusb_mt352_frontend_attach,
+       .tuner_attach     = cxusb_dtt7579_tuner_attach,
+
+       .i2c_algo         = &cxusb_i2c_algo,
+
+       .generic_bulk_ctrl_endpoint = 0x01,
+       /* parameter for the MPEG2-data transfer */
+       .urb = {
+               .type = DVB_USB_BULK,
+               .count = 5,
+               .endpoint = 0x04,
+               .u = {
+                       .bulk = {
+                               .buffersize = 8192,
+                       }
+               }
+       },
+
+       .num_device_descs = 1,
+       .devices = {
+               {   "DViCO FusionHDTV DVB-T USB (TH7579)",
+                       { &cxusb_table[7], NULL },
+                       { &cxusb_table[8], NULL },
+               },
        }
 };
 
index 0a94ec22aeb863bc7423d8fc55882ff3daae640f..cd21ddbfd05479f9be098ba01e8fe8c1011f064c 100644 (file)
@@ -156,10 +156,9 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d)
        struct dtt200u_fe_state* state = NULL;
 
        /* allocate memory for the internal state */
-       state = (struct dtt200u_fe_state*) kmalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
-       memset(state,0,sizeof(struct dtt200u_fe_state));
 
        deb_info("attaching frontend dtt200u\n");
 
index d229343832265f175af3f7778e3b556ed817ac34..4a1b9e77e339518cb9b452f02a63b65e986f0c2c 100644 (file)
@@ -95,6 +95,8 @@
 #define USB_PID_DVICO_BLUEBIRD_TH7579_WARM             0xdb11
 #define USB_PID_DVICO_BLUEBIRD_DEE1601_COLD            0xdb50
 #define USB_PID_DVICO_BLUEBIRD_DEE1601_WARM            0xdb51
+#define USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD       0xdb54
+#define USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM       0xdb55
 #define USB_PID_MEDION_MD95700                         0x0932
 #define USB_PID_KYE_DVB_T_COLD                         0x701e
 #define USB_PID_KYE_DVB_T_WARM                         0x701f
index 2e23060cbbca736c4f8a0ea690ee3a893d36b9e9..716f8bf528cdc1999fe00d658f0e643ff8968750 100644 (file)
@@ -154,12 +154,11 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties
        }
 
        info("found a '%s' in warm state.",desc->name);
-       d = kmalloc(sizeof(struct dvb_usb_device),GFP_KERNEL);
+               d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL);
        if (d == NULL) {
                err("no memory for 'struct dvb_usb_device'");
                return ret;
        }
-       memset(d,0,sizeof(struct dvb_usb_device));
 
        d->udev = udev;
        memcpy(&d->props,props,sizeof(struct dvb_usb_properties));
@@ -167,13 +166,12 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties
        d->owner = owner;
 
        if (d->props.size_of_priv > 0) {
-               d->priv = kmalloc(d->props.size_of_priv,GFP_KERNEL);
+                       d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL);
                if (d->priv == NULL) {
                        err("no memory for priv in 'struct dvb_usb_device'");
                        kfree(d);
                        return -ENOMEM;
                }
-               memset(d->priv,0,d->props.size_of_priv);
        }
 
        usb_set_intfdata(intf, d);
index 36b7048c02d26616a5f18794f0a7116cb5309f1c..ee821974dc604a97d9fed5ffa084f620e2c14a60 100644 (file)
@@ -175,15 +175,13 @@ static int dvb_usb_allocate_stream_buffers(struct dvb_usb_device *d, int num, un
 
        deb_mem("all in all I will use %lu bytes for streaming\n",num*size);
 
-       if ((d->buf_list = kmalloc(num*sizeof(u8 *), GFP_ATOMIC)) == NULL)
+       if ((d->buf_list = kcalloc(num, sizeof(u8 *), GFP_ATOMIC)) == NULL)
                return -ENOMEM;
 
-       if ((d->dma_addr = kmalloc(num*sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) {
+       if ((d->dma_addr = kcalloc(num, sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) {
                kfree(d->buf_list);
                return -ENOMEM;
        }
-       memset(d->buf_list,0,num*sizeof(u8 *));
-       memset(d->dma_addr,0,num*sizeof(dma_addr_t));
 
        d->state |= DVB_USB_STATE_URB_BUF;
 
@@ -285,10 +283,9 @@ int dvb_usb_urb_init(struct dvb_usb_device *d)
        usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint));
 
        /* allocate the array for the data transfer URBs */
-       d->urb_list = kmalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL);
+       d->urb_list = kzalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL);
        if (d->urb_list == NULL)
                return -ENOMEM;
-       memset(d->urb_list,0,d->props.urb.count * sizeof(struct urb *));
        d->state |= DVB_USB_STATE_URB_LIST;
 
        switch (d->props.urb.type) {
index 0885d9fb2bf231a6373fbbc30725d0adaf5ae67d..b6d95e1c9c527d7d799ecf4e20cb435973f469c6 100644 (file)
@@ -281,10 +281,9 @@ static struct dvb_frontend_ops vp702x_fe_ops;
 
 struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d)
 {
-       struct vp702x_fe_state *s = kmalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL);
+       struct vp702x_fe_state *s = kzalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL);
        if (s == NULL)
                goto error;
-       memset(s,0,sizeof(struct vp702x_fe_state));
 
        s->d = d;
        s->fe.ops = &vp702x_fe_ops;
index 83f1de1e7e571daaede818ace9b90c50fbab484a..5242cca5db4a2a7ca4e9213cb450401a82cbbfcb 100644 (file)
@@ -145,10 +145,9 @@ static struct dvb_frontend_ops vp7045_fe_ops;
 
 struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d)
 {
-       struct vp7045_fe_state *s = kmalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL);
+       struct vp7045_fe_state *s = kzalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL);
        if (s == NULL)
                goto error;
-       memset(s,0,sizeof(struct vp7045_fe_state));
 
        s->d = d;
        s->fe.ops = &vp7045_fe_ops;
index 3b132bafd4de0f0f39bcf87ab83b5b05ae444c88..caaee893ca7674d048ba91b16c084c09b5934fd8 100644 (file)
@@ -782,10 +782,9 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config,
        bcm3510_register_value v;
 
        /* allocate memory for the internal state */
-       state = kmalloc(sizeof(struct bcm3510_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct bcm3510_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
-       memset(state,0,sizeof(struct bcm3510_state));
 
        /* setup the state */
 
index 6b05536086109fd40a1b3c1a9a9c3a9e89b58365..ae589adb1c0a47b9960bb9e5a130f47dc1619fe7 100644 (file)
@@ -700,10 +700,9 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
        struct dib3000_state* state = NULL;
 
        /* allocate memory for the internal state */
-       state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
-       memset(state,0,sizeof(struct dib3000_state));
 
        /* setup the state */
        state->i2c = i2c;
index c024fad173370f62f8222cbcb947de31b530bf0a..3b303dbb61565db54ed15b4bbab810be2c622860 100644 (file)
@@ -832,10 +832,9 @@ struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config,
        u16 devid;
 
        /* allocate memory for the internal state */
-       state = kmalloc(sizeof(struct dib3000_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
-       memset(state,0,sizeof(struct dib3000_state));
 
        /* setup the state */
        state->i2c = i2c;
index a3d57ce9dd1230ded1a291ad590e39703dcf7c54..757075f007c15432360511c24d814892b4f65a02 100644 (file)
@@ -345,6 +345,23 @@ struct dvb_pll_desc dvb_pll_tbmv30111in = {
 };
 EXPORT_SYMBOL(dvb_pll_tbmv30111in);
 
+/*
+ * Philips SD1878 Tuner.
+ */
+struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261 = {
+       .name  = "Philips SD1878",
+       .min   =  950000,
+       .max   = 2150000,
+       .count = 4,
+       .entries = {
+               { 1250000, 499, 500, 0xc4, 0x00},
+               { 1550000, 499, 500, 0xc4, 0x40},
+               { 2050000, 499, 500, 0xc4, 0x80},
+               { 2150000, 499, 500, 0xc4, 0xc0},
+       },
+};
+EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda8261);
+
 /* ----------------------------------------------------------- */
 /* code                                                        */
 
index 24d4d2e9acd8fdcc6361621454af2c43a110cb18..f682c09189b305ac015d45a12c3ea28fe5921273 100644 (file)
@@ -39,6 +39,7 @@ extern struct dvb_pll_desc dvb_pll_tded4;
 extern struct dvb_pll_desc dvb_pll_tuv1236d;
 extern struct dvb_pll_desc dvb_pll_tdhu2;
 extern struct dvb_pll_desc dvb_pll_tbmv30111in;
+extern struct dvb_pll_desc dvb_pll_philips_sd1878_tda8261;
 
 int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
                      u32 freq, int bandwidth);
index 9d214643b87a4c65e1551070adfc636165bc13c4..4691ac54bc1d2a8f3202fb43cae0f504d9a8ce7e 100644 (file)
@@ -714,10 +714,9 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
        u8 buf[1];
 
        /* Allocate memory for the internal state */
-       state = (struct lgdt330x_state*) kmalloc(sizeof(struct lgdt330x_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct lgdt330x_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
-       memset(state,0,sizeof(*state));
 
        /* Setup the state */
        state->config = config;
index f0c610f2c2dfe437e696417cf5aafbe8c3d71848..aaaec909ddf830f0372bdf11d19aff43a164852c 100644 (file)
@@ -535,9 +535,8 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config,
        struct mt352_state* state = NULL;
 
        /* allocate memory for the internal state */
-       state = kmalloc(sizeof(struct mt352_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct mt352_state), GFP_KERNEL);
        if (state == NULL) goto error;
-       memset(state,0,sizeof(*state));
 
        /* setup the state */
        state->i2c = i2c;
index aeafef46e3ebd4b68bd03b94624a0fdb3720d83a..78d2b93d35b9d7670beab86263fa0dbd46c6be14 100644 (file)
@@ -1110,10 +1110,9 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config,
        u8 buf [] = {0,0,0,0,0};
 
        /* allocate memory for the internal state */
-       state = (struct nxt200x_state*) kmalloc(sizeof(struct nxt200x_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct nxt200x_state), GFP_KERNEL);
        if (state == NULL)
                goto error;
-       memset(state,0,sizeof(*state));
 
        /* setup the state */
        state->config = config;
index bbebd1c4caca575fb7cd0890e30105bd68ae7b34..1c5316e209efc9993ccc4d4def81e3032e6142e6 100644 (file)
@@ -584,11 +584,10 @@ static int __devinit pluto2_probe(struct pci_dev *pdev,
        struct dmx_demux *dmx;
        int ret = -ENOMEM;
 
-       pluto = kmalloc(sizeof(struct pluto), GFP_KERNEL);
+       pluto = kzalloc(sizeof(struct pluto), GFP_KERNEL);
        if (!pluto)
                goto out;
 
-       memset(pluto, 0, sizeof(struct pluto));
        pluto->pdev = pdev;
 
        ret = pci_enable_device(pdev);
index 8ce4146f55f12cc96953e1f96e6b0826fa3ea684..327a8089193b7332a0342abbbcff7f0ae6d259f7 100644 (file)
@@ -2565,14 +2565,12 @@ static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_d
        }
 
        /* prepare the av7110 device struct */
-       av7110 = kmalloc(sizeof(struct av7110), GFP_KERNEL);
+       av7110 = kzalloc(sizeof(struct av7110), GFP_KERNEL);
        if (!av7110) {
                dprintk(1, "out of memory\n");
                return -ENOMEM;
        }
 
-       memset(av7110, 0, sizeof(struct av7110));
-
        av7110->card_name = (char*) pci_ext->ext_priv;
        av7110->dev = dev;
        dev->ext_priv = av7110;
index f9d00452e6393132c9bc044b8215bffca5eba680..1465c04e49aa843fd7c127201afecba0790b0370 100644 (file)
@@ -37,6 +37,7 @@
 #include "stv0299.h"
 #include "tda10021.h"
 #include "tda1004x.h"
+#include "dvb-pll.h"
 #include <media/saa7146_vv.h>
 #include <linux/module.h>
 #include <linux/errno.h>
@@ -864,8 +865,117 @@ static struct tda1004x_config philips_tu1216_config = {
        .request_firmware = philips_tu1216_request_firmware,
 };
 
+static u8 philips_sd1878_inittab[] = {
+       0x01, 0x15,
+       0x02, 0x30,
+       0x03, 0x00,
+       0x04, 0x7d,
+       0x05, 0x35,
+       0x06, 0x40,
+       0x07, 0x00,
+       0x08, 0x43,
+       0x09, 0x02,
+       0x0C, 0x51,
+       0x0D, 0x82,
+       0x0E, 0x23,
+       0x10, 0x3f,
+       0x11, 0x84,
+       0x12, 0xb9,
+       0x15, 0xc9,
+       0x16, 0x19,
+       0x17, 0x8c,
+       0x18, 0x59,
+       0x19, 0xf8,
+       0x1a, 0xfe,
+       0x1c, 0x7f,
+       0x1d, 0x00,
+       0x1e, 0x00,
+       0x1f, 0x50,
+       0x20, 0x00,
+       0x21, 0x00,
+       0x22, 0x00,
+       0x23, 0x00,
+       0x28, 0x00,
+       0x29, 0x28,
+       0x2a, 0x14,
+       0x2b, 0x0f,
+       0x2c, 0x09,
+       0x2d, 0x09,
+       0x31, 0x1f,
+       0x32, 0x19,
+       0x33, 0xfc,
+       0x34, 0x93,
+       0xff, 0xff
+};
+
+static int philips_sd1878_tda8261_pll_set(struct dvb_frontend *fe,
+               struct i2c_adapter *i2c,
+               struct dvb_frontend_parameters *params)
+{
+       u8              buf[4];
+       int             rc;
+       struct i2c_msg  tuner_msg = {.addr=0x60,.flags=0,.buf=buf,.len=sizeof(buf)};
+
+       if((params->frequency < 950000) || (params->frequency > 2150000))
+               return -EINVAL;
+
+       rc=dvb_pll_configure(&dvb_pll_philips_sd1878_tda8261, buf,
+                       params->frequency, 0);
+       if(rc < 0) return rc;
+
+       if(i2c_transfer(i2c, &tuner_msg, 1) != 1)
+               return -EIO;
+
+    return 0;
+}
+
+static int philips_sd1878_ci_set_symbol_rate(struct dvb_frontend *fe,
+               u32 srate, u32 ratio)
+{
+       u8 aclk = 0;
+       u8 bclk = 0;
+       u8 m1;
+
+       aclk = 0xb5;
+       if (srate < 2000000)
+               bclk = 0x86;
+       else if (srate < 5000000)
+               bclk = 0x89;
+       else if (srate < 15000000)
+               bclk = 0x8f;
+       else if (srate < 45000000)
+               bclk = 0x95;
+
+       m1 = 0x14;
+       if (srate < 4000000)
+               m1 = 0x10;
+
+       stv0299_writereg(fe, 0x0e, 0x23);
+       stv0299_writereg(fe, 0x0f, 0x94);
+       stv0299_writereg(fe, 0x10, 0x39);
+       stv0299_writereg(fe, 0x13, aclk);
+       stv0299_writereg(fe, 0x14, bclk);
+       stv0299_writereg(fe, 0x15, 0xc9);
+       stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
+       stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
+       stv0299_writereg(fe, 0x21, (ratio) & 0xf0);
+       stv0299_writereg(fe, 0x0f, 0x80 | m1);
 
+       return 0;
+}
 
+static struct stv0299_config philips_sd1878_config = {
+       .demod_address = 0x68,
+       .inittab = philips_sd1878_inittab,
+       .mclk = 88000000UL,
+       .invert = 0,
+       .skip_reinit = 0,
+       .lock_output = STV0229_LOCKOUTPUT_1,
+       .volt13_op0_op1 = STV0299_VOLT13_OP0,
+       .min_delay_ms = 100,
+       .set_symbol_rate = philips_sd1878_ci_set_symbol_rate,
+       .pll_set = philips_sd1878_tda8261_pll_set,
+};
 
 static u8 read_pwm(struct budget_av *budget_av)
 {
@@ -886,7 +996,10 @@ static u8 read_pwm(struct budget_av *budget_av)
 #define SUBID_DVBS_KNC1_PLUS   0x0011
 #define SUBID_DVBS_TYPHOON     0x4f56
 #define SUBID_DVBS_CINERGY1200 0x1154
+#define SUBID_DVBS_CYNERGY1200N 0x1155
 
+#define SUBID_DVBS_TV_STAR     0x0014
+#define SUBID_DVBS_TV_STAR_CI  0x0016
 #define SUBID_DVBC_KNC1                0x0020
 #define SUBID_DVBC_KNC1_PLUS   0x0021
 #define SUBID_DVBC_CINERGY1200 0x1156
@@ -922,6 +1035,13 @@ static void frontend_init(struct budget_av *budget_av)
                }
                break;
 
+       case SUBID_DVBS_TV_STAR:
+       case SUBID_DVBS_TV_STAR_CI:
+       case SUBID_DVBS_CYNERGY1200N:
+               fe = stv0299_attach(&philips_sd1878_config,
+                               &budget_av->budget.i2c_adap);
+               break;
+
        case SUBID_DVBS_KNC1_PLUS:
        case SUBID_DVBS_TYPHOON:
                fe = stv0299_attach(&typhoon_config,
@@ -1027,11 +1147,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
 
        dprintk(2, "dev: %p\n", dev);
 
-       if (!(budget_av = kmalloc(sizeof(struct budget_av), GFP_KERNEL)))
+       if (!(budget_av = kzalloc(sizeof(struct budget_av), GFP_KERNEL)))
                return -ENOMEM;
 
-       memset(budget_av, 0, sizeof(struct budget_av));
-
        budget_av->has_saa7113 = 0;
        budget_av->budget.ci_present = 0;
 
@@ -1166,10 +1284,12 @@ static struct saa7146_extension budget_extension;
 MAKE_BUDGET_INFO(knc1s, "KNC1 DVB-S", BUDGET_KNC1S);
 MAKE_BUDGET_INFO(knc1c, "KNC1 DVB-C", BUDGET_KNC1C);
 MAKE_BUDGET_INFO(knc1t, "KNC1 DVB-T", BUDGET_KNC1T);
+MAKE_BUDGET_INFO(kncxs, "KNC TV STAR DVB-S", BUDGET_TVSTAR);
 MAKE_BUDGET_INFO(knc1sp, "KNC1 DVB-S Plus", BUDGET_KNC1SP);
 MAKE_BUDGET_INFO(knc1cp, "KNC1 DVB-C Plus", BUDGET_KNC1CP);
 MAKE_BUDGET_INFO(knc1tp, "KNC1 DVB-T Plus", BUDGET_KNC1TP);
 MAKE_BUDGET_INFO(cin1200s, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S);
+MAKE_BUDGET_INFO(cin1200sn, "TerraTec Cinergy 1200 DVB-S", BUDGET_CIN1200S);
 MAKE_BUDGET_INFO(cin1200c, "Terratec Cinergy 1200 DVB-C", BUDGET_CIN1200C);
 MAKE_BUDGET_INFO(cin1200t, "Terratec Cinergy 1200 DVB-T", BUDGET_CIN1200T);
 
@@ -1178,11 +1298,14 @@ static struct pci_device_id pci_tbl[] = {
        MAKE_EXTENSION_PCI(knc1s, 0x1131, 0x0010),
        MAKE_EXTENSION_PCI(knc1s, 0x1894, 0x0010),
        MAKE_EXTENSION_PCI(knc1sp, 0x1131, 0x0011),
+       MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0014),
+       MAKE_EXTENSION_PCI(kncxs, 0x1894, 0x0016),
        MAKE_EXTENSION_PCI(knc1c, 0x1894, 0x0020),
        MAKE_EXTENSION_PCI(knc1cp, 0x1894, 0x0021),
        MAKE_EXTENSION_PCI(knc1t, 0x1894, 0x0030),
        MAKE_EXTENSION_PCI(knc1tp, 0x1894, 0x0031),
        MAKE_EXTENSION_PCI(cin1200s, 0x153b, 0x1154),
+       MAKE_EXTENSION_PCI(cin1200sn, 0x153b, 0x1155),
        MAKE_EXTENSION_PCI(cin1200c, 0x153b, 0x1156),
        MAKE_EXTENSION_PCI(cin1200t, 0x153b, 0x1157),
        {
index c8d48cfba277fc8817f910cd0585e01660010c40..c7bb63c4d98dc086253fc2f377408a0ec8c95fda 100644 (file)
@@ -95,6 +95,7 @@ static struct saa7146_pci_extension_data x_var = { \
 #define BUDGET_KNC1SP             11
 #define BUDGET_KNC1CP             12
 #define BUDGET_KNC1TP             13
+#define BUDGET_TVSTAR             14
 
 #define BUDGET_VIDEO_PORTA         0
 #define BUDGET_VIDEO_PORTB         1
index 104df610dbe1d59b81b5488f92a65e500a6e7986..5a13c4744f616d9799af9e6858f51c9ce5ce141e 100644 (file)
@@ -1489,11 +1489,9 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
 
        if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV;
 
-       if (!(ttusb = kmalloc(sizeof(struct ttusb), GFP_KERNEL)))
+       if (!(ttusb = kzalloc(sizeof(struct ttusb), GFP_KERNEL)))
                return -ENOMEM;
 
-       memset(ttusb, 0, sizeof(struct ttusb));
-
        ttusb->dev = udev;
        ttusb->c = 0;
        ttusb->mux_state = 0;
index d8966d1d25ee7c613df1411d20d558a00351d81a..df831171e03ca3ba92e65fac70e78a8f9c6cc08e 100644 (file)
@@ -1606,15 +1606,13 @@ static int ttusb_dec_probe(struct usb_interface *intf,
 
        udev = interface_to_usbdev(intf);
 
-       if (!(dec = kmalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) {
+       if (!(dec = kzalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) {
                printk("%s: couldn't allocate memory.\n", __FUNCTION__);
                return -ENOMEM;
        }
 
        usb_set_intfdata(intf, (void *)dec);
 
-       memset(dec, 0, sizeof(struct ttusb_dec));
-
        switch (le16_to_cpu(id->idProduct)) {
        case 0x1006:
                ttusb_dec_set_model(dec, TTUSB_DEC3000S);
index 69ac8aa73eba45f2f974af726e7443a247198ec8..8e499b8f64c79e88474db41b93f6ae824c164db1 100644 (file)
@@ -318,11 +318,10 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
        struct gemtek_pci_card *card;
        struct video_device *devradio;
 
-       if ( (card = kmalloc( sizeof( struct gemtek_pci_card ), GFP_KERNEL )) == NULL ) {
+       if ( (card = kzalloc( sizeof( struct gemtek_pci_card ), GFP_KERNEL )) == NULL ) {
                printk( KERN_ERR "gemtek_pci: out of memory\n" );
                return -ENOMEM;
        }
-       memset( card, 0, sizeof( struct gemtek_pci_card ) );
 
        if ( pci_enable_device( pci_dev ) ) 
                goto err_pci;
index 2fe260fff85dd25b8d952f23dfbaff412cea4848..d82c8a30ba44373e137ba43b7fe8f0067d156119 100644 (file)
@@ -183,7 +183,7 @@ config VIDEO_STRADIS
        help
          Say Y here to enable support for the Stradis 4:2:2 MPEG-2 video
          driver for PCI.  There is a product page at
-         <http://www.stradis.com/decoder.html>.
+         <http://www.stradis.com/>.
 
 config VIDEO_ZORAN
        tristate "Zoran ZR36057/36067 Video For Linux"
index e61003de1d5f760281b4bb55e5032fe3a9554c86..4ce07ae62dac4048fe0b58701c1a12d0f7a87ba4 100644 (file)
@@ -413,10 +413,9 @@ adv7170_detect_client (struct i2c_adapter *adapter,
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_adv7170;
@@ -433,12 +432,11 @@ adv7170_detect_client (struct i2c_adapter *adapter,
        }
        strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client)));
 
-       encoder = kmalloc(sizeof(struct adv7170), GFP_KERNEL);
+       encoder = kzalloc(sizeof(struct adv7170), GFP_KERNEL);
        if (encoder == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(encoder, 0, sizeof(struct adv7170));
        encoder->norm = VIDEO_MODE_NTSC;
        encoder->input = 0;
        encoder->enable = 1;
index 6d9536a71ee437854f41aeeceb2feea9ed47ddea..4e218f22b214653aaad19696be4303eef2120ae0 100644 (file)
@@ -463,10 +463,9 @@ adv7175_detect_client (struct i2c_adapter *adapter,
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_adv7175;
@@ -483,12 +482,11 @@ adv7175_detect_client (struct i2c_adapter *adapter,
        }
        strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client)));
 
-       encoder = kmalloc(sizeof(struct adv7175), GFP_KERNEL);
+       encoder = kzalloc(sizeof(struct adv7175), GFP_KERNEL);
        if (encoder == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(encoder, 0, sizeof(struct adv7175));
        encoder->norm = VIDEO_MODE_PAL;
        encoder->input = 0;
        encoder->enable = 1;
index 560b998917538d5b08b3bccdfb90bec69c901291..d6447791d0e5914545a8501fc0cee5574a9b9acc 100644 (file)
@@ -528,21 +528,18 @@ bt819_detect_client (struct i2c_adapter *adapter,
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_bt819;
 
-       decoder = kmalloc(sizeof(struct bt819), GFP_KERNEL);
+       decoder = kzalloc(sizeof(struct bt819), GFP_KERNEL);
        if (decoder == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-
-       memset(decoder, 0, sizeof(struct bt819));
        decoder->norm = VIDEO_MODE_NTSC;
        decoder->input = 0;
        decoder->enable = 1;
index dda4aa6bef27c6da07a6fc104faef8972075edfe..07c78f1f7a44e323177dd5e0f6310ba3a9cef25b 100644 (file)
@@ -75,13 +75,13 @@ int bt832_hexdump(struct i2c_client *i2c_client_s, unsigned char *buf)
 
        if(debug>1) {
                int i;
-               v4l_dbg(2,i2c_client_s,"hexdump:");
+               v4l_dbg(2, debug,i2c_client_s,"hexdump:");
                for(i=1;i<65;i++) {
                        if(i!=1) {
                                if(((i-1)%8)==0) printk(" ");
                                if(((i-1)%16)==0) {
                                        printk("\n");
-                                       v4l_dbg(2,i2c_client_s,"hexdump:");
+                                       v4l_dbg(2, debug,i2c_client_s,"hexdump:");
                                }
                        }
                        printk(" %02x",buf[i]);
@@ -167,9 +167,8 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, int kind)
        client_template.adapter = adap;
        client_template.addr    = addr;
 
-       if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL)))
+       if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL)))
                return -ENOMEM;
-       memset(t,0,sizeof(*t));
        t->client = client_template;
        i2c_set_clientdata(&t->client, t);
        i2c_attach_client(&t->client);
index 60508069bbedf73425f0196081c4bcf80e7476be..909b593530edf30fe25ac12377f0f1a5f3ad533d 100644 (file)
@@ -316,21 +316,19 @@ bt856_detect_client (struct i2c_adapter *adapter,
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_bt856;
        strlcpy(I2C_NAME(client), "bt856", sizeof(I2C_NAME(client)));
 
-       encoder = kmalloc(sizeof(struct bt856), GFP_KERNEL);
+       encoder = kzalloc(sizeof(struct bt856), GFP_KERNEL);
        if (encoder == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(encoder, 0, sizeof(struct bt856));
        encoder->norm = VIDEO_MODE_NTSC;
        encoder->enable = 1;
        i2c_set_clientdata(client, encoder);
index 1621ab133d232aa87b633039959c5def48071f10..65323e78d5fd4583b13b72421dfd7ca04bc8aa6b 100644 (file)
@@ -321,7 +321,7 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 1,
                .tuner          = 0,
                .svhs           = 2,
-               .muxsel         = { 2, 3, 1, 0},
+               .muxsel         = { 2, 3, 1, 0 },
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
@@ -333,8 +333,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 15,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 2, 0, 0, 0, 10},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 2, 0, 0, 0, 10 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -347,8 +347,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 7,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0, 1, 2, 3, 4},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0, 1, 2, 3, 4 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -361,8 +361,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 7,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 4, 0, 2, 3, 1},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 4, 0, 2, 3, 1 },
                .no_msp34xx     = 1,
                .needs_tvaudio  = 1,
                .tuner_type     = TUNER_PHILIPS_NTSC,
@@ -380,7 +380,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1,
                .svhs           = 2,
                .gpiomask       = 0,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0 },
                .needs_tvaudio  = 0,
                .tuner_type     = 4,
@@ -394,8 +394,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 3,
-               .muxsel         = { 2, 3, 1, 0},
-               .audiomux       = { 0, 1, 0, 1, 3},
+               .muxsel         = { 2, 3, 1, 0 },
+               .audiomux       = { 0, 1, 0, 1, 3 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -407,9 +407,9 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 1,
                .tuner          = 0,
                .svhs           = 3,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .gpiomask       = 0x0f,
-               .audiomux       = { 0x0c, 0x04, 0x08, 0x04, 0},
+               .audiomux       = { 0x0c, 0x04, 0x08, 0x04, 0 },
                /*                0x04 for some cards ?? */
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
@@ -425,8 +425,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1,
                .svhs           = 3,
                .gpiomask       = 0,
-               .muxsel         = { 2, 3, 1, 0, 0},
-               .audiomux       = {0 },
+               .muxsel         = { 2, 3, 1, 0, 0 },
+               .audiomux       = { 0 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -441,8 +441,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0xc00,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0, 0xc00, 0x800, 0x400, 0xc00, 0},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0, 0xc00, 0x800, 0x400, 0xc00, 0 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -456,8 +456,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 3,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 1, 1, 2, 3, 0},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 1, 1, 2, 3, 0 },
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_TEMIC_PAL,
@@ -471,8 +471,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x0f, /* old: 7 */
-               .muxsel         = { 2, 0, 1, 1},
-               .audiomux       = { 0, 1, 2, 3, 4},
+               .muxsel         = { 2, 0, 1, 1 },
+               .audiomux       = { 0, 1, 2, 3, 4 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -486,8 +486,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x3014f,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0x20001,0x10001, 0, 0,10},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0x20001,0x10001, 0, 0,10 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -502,8 +502,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 15,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 13, 14, 11, 7, 0, 0},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 13, 14, 11, 7, 0, 0 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -516,8 +516,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 15,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 13, 14, 11, 7, 0, 0},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 13, 14, 11, 7, 0, 0 },
                .needs_tvaudio  = 1,
                .msp34xx_alt    = 1,
                .pll            = PLL_28,
@@ -534,8 +534,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 7,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0, 2, 1, 3, 4}, /* old: { 0, 1, 2, 3, 4} */
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0, 2, 1, 3, 4 }, /* old: {0, 1, 2, 3, 4} */
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -549,8 +549,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 15,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = {0 , 0, 1 , 0, 10},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0 , 0, 1 , 0, 10 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -565,7 +565,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x01fe00,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
        #if 0
                /* old */
                .audiomux       = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
@@ -584,8 +584,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x8300f8,
-               .muxsel         = { 2, 3, 1, 1,0},
-               .audiomux       = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007},
+               .muxsel         = { 2, 3, 1, 1,0 },
+               .audiomux       = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -600,8 +600,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0,
-               .muxsel         = {2, 3, 1, 1},
-               .audiomux       = {1, 0, 0, 0, 0},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 1, 0, 0, 0, 0 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -614,7 +614,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1,
                .svhs           = -1,
                .gpiomask       = 0x8dff00,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0 },
                .no_msp34xx     = 1,
                .tuner_type     = -1,
@@ -629,7 +629,7 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 3,
                .tuner          = 0,
                .svhs           = 2,
-               .muxsel         = {2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
@@ -641,8 +641,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x1800,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800 },
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL_I,
                .tuner_addr     = ADDR_UNSET,
@@ -655,8 +655,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0xc00,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = {0, 1, 0x800, 0x400, 0xc00, 0},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0, 1, 0x800, 0x400, 0xc00, 0 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -688,8 +688,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0xe00,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = {0x400, 0x400, 0x400, 0x400, 0xc00},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = {0x400, 0x400, 0x400, 0x400, 0xc00 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -704,8 +704,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x1f0fff,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0x20000, 0x30000, 0x10000, 0, 0x40000},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0x20000, 0x30000, 0x10000, 0, 0x40000 },
                .needs_tvaudio  = 0,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -719,8 +719,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 3,
                .gpiomask       = 7,
-               .muxsel         = { 2, 0, 1, 1},
-               .audiomux       = { 0, 1, 2, 3, 4},
+               .muxsel         = { 2, 0, 1, 1 },
+               .audiomux       = { 0, 1, 2, 3, 4 },
                .needs_tvaudio  = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -733,8 +733,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x1800,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800 },
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_SECAM,
                .tuner_addr     = ADDR_UNSET,
@@ -749,8 +749,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x1f0fff,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000 },
                .needs_tvaudio  = 0,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -812,7 +812,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x1800,  /* 0x8dfe00 */
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 },
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -826,7 +826,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 3,
                .gpiomask       = 1,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 1, 0, 0, 0, 0 },
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -842,7 +842,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1,
                .svhs           = 2,
                .gpiomask       = 0,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0 },
                .needs_tvaudio  = 0,
                .tuner_type     = 4,
@@ -856,8 +856,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0xffff00,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0x500, 0, 0x300, 0x900, 0x900},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0x500, 0, 0x300, 0x900, 0x900 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -870,7 +870,7 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 1,
                .tuner          = 0,
                .svhs           = 2,
-               .muxsel         = { 2, 3, 1, 1, 0}, /* TV, CVid, SVid, CVid over SVid connector */
+               .muxsel         = { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */
        #if 0
                .gpiomask       = 0xc33000,
                .audiomux       = { 0x422000,0x1000,0x0000,0x620000,0x800000 },
@@ -906,8 +906,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x1800,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800 },
                .pll            = PLL_28,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -922,7 +922,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x1800,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -952,7 +952,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x551e00,
-               .muxsel         = { 2, 3, 1, 0},
+               .muxsel         = { 2, 3, 1, 0 },
                .audiomux       = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
@@ -968,8 +968,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x03000F,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 2, 0xd0001, 0, 0, 1},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 2, 0xd0001, 0, 0, 1 },
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -985,8 +985,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 7,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 4, 0, 2, 3, 1},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 4, 0, 2, 3, 1 },
                .no_msp34xx     = 1,
                .needs_tvaudio  = 1,
                .tuner_type     = TUNER_PHILIPS_NTSC,
@@ -1002,8 +1002,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 15,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 13, 4, 11, 7, 0, 0},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 13, 4, 11, 7, 0, 0 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -1035,8 +1035,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0xe00b,
-               .muxsel         = {2, 3, 1, 1},
-               .audiomux       = {0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc },
                .no_msp34xx     = 1,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -1051,8 +1051,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = -1,
                .gpiomask       = 3,
-               .muxsel         = {2, 3, 1, 1},
-               .audiomux       = {1, 1, 0, 2, 3},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 1, 1, 0, 2, 3 },
                .no_msp34xx     = 1,
                .pll            = PLL_NONE,
                .tuner_type     = -1,
@@ -1066,8 +1066,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1,
                .svhs           = 3,
                .gpiomask       = 0,
-               .muxsel         = { 2, 3, 1, 0, 0},
-               .audiomux       = {0 },
+               .muxsel         = { 2, 3, 1, 0, 0 },
+               .audiomux       = { 0 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -1081,8 +1081,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0xbcf03f,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = 21,
@@ -1096,7 +1096,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x70000,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 },
                .needs_tvaudio  = 1,
                .no_msp34xx     = 1,
@@ -1115,8 +1115,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 15,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = {2,0,0,0,1},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = {2,0,0,0,1 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -1130,8 +1130,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x010f00,
-               .muxsel         = {2, 3, 0, 0},
-               .audiomux       = {0x10000, 0, 0x10000, 0, 0, 0},
+               .muxsel         = {2, 3, 0, 0 },
+               .audiomux       = {0x10000, 0, 0x10000, 0, 0, 0 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_ALPS_TSHC6_NTSC,
@@ -1172,8 +1172,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 7,
-               .muxsel         = { 2, 0, 1, 1},
-               .audiomux       = { 0, 1, 2, 3, 4},
+               .muxsel         = { 2, 0, 1, 1 },
+               .audiomux       = { 0, 1, 2, 3, 4 },
                .pll            = PLL_28,
                .tuner_type     = -1 /* TUNER_ALPS_TMDH2_NTSC */,
                .tuner_addr     = ADDR_UNSET,
@@ -1189,8 +1189,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 3,
                .gpiomask       = 0x03000F,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 1, 0xd0001, 0, 0, 10},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 1, 0xd0001, 0, 0, 10 },
                                /* sound path (5 sources):
                                MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable)
                                        0= ext. Audio IN
@@ -1215,7 +1215,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x1c,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0, 0, 0x10, 8, 4 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
@@ -1236,7 +1236,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x18e0,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0x0000,0x0800,0x1000,0x1000,0x18e0 },
                        /* For cards with tda9820/tda9821:
                                0x0000: Tuner normal stereo
@@ -1256,8 +1256,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0xF,
-               .muxsel         = { 2, 3, 1, 0},
-               .audiomux       = { 2, 0, 0, 0, 10},
+               .muxsel         = { 2, 3, 1, 0 },
+               .audiomux       = { 2, 0, 0, 0, 10 },
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_TEMIC_PAL,
@@ -1274,7 +1274,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x1800,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 },
                .pll            = PLL_28,
                .tuner_type     = 5,
@@ -1324,8 +1324,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x03000F,
-               .muxsel         = { 2, 3, 1, 0},
-               .audiomux       = { 2,0,0,0,1 },
+               .muxsel         = { 2, 3, 1, 0 },
+               .audiomux       = { 2, 0, 0, 0, 1 },
                .pll            = PLL_28,
                .tuner_type     = 0,
                .tuner_addr     = ADDR_UNSET,
@@ -1341,8 +1341,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = -1,
                .gpiomask       = 11,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 2, 0, 0, 1, 8},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 2, 0, 0, 1, 8 },
                .pll            = PLL_35,
                .tuner_type     = TUNER_TEMIC_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -1356,7 +1356,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1,
                .svhs           = 1,
                .gpiomask       = 0xF,
-               .muxsel         = { 2, 2},
+               .muxsel         = { 2, 2 },
                .audiomux       = { },
                .no_msp34xx     = 1,
                .needs_tvaudio  = 0,
@@ -1375,8 +1375,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0xFF,
-               .muxsel         = { 2, 3, 1, 0},
-               .audiomux       = { 1, 0, 4, 4, 9},
+               .muxsel         = { 2, 3, 1, 0 },
+               .audiomux       = { 1, 0, 4, 4, 9 },
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -1392,7 +1392,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0xf03f,
                .muxsel         = { 2, 3, 1, 0 },
-               .audiomux       = { 0xbffe, 0, 0xbfff, 0, 0xbffe},
+               .audiomux       = { 0xbffe, 0, 0xbfff, 0, 0xbffe },
                .pll            = PLL_28,
                .tuner_type     = TUNER_TEMIC_4006FN5_MULTI_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -1408,8 +1408,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = -1,
                .gpiomask       = 1,
-               .muxsel         = { 2, 3, 0, 1},
-               .audiomux       = { 0, 0, 1, 0, 0},
+               .muxsel         = { 2, 3, 0, 1 },
+               .audiomux       = { 0, 0, 1, 0, 0 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_TEMIC_4006FN5_MULTI_PAL,
@@ -1424,7 +1424,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x18e0,
-               .muxsel         = { 2, 3, 0, 1},
+               .muxsel         = { 2, 3, 0, 1 },
                                /* Radio changed from 1e80 to 0x800 to make
                                FlyVideo2000S in .hu happy (gm)*/
                                /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
@@ -1445,8 +1445,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0xffff00,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0x500, 0x500, 0x300, 0x900, 0x900},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0x500, 0x500, 0x300, 0x900, 0x900 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -1462,8 +1462,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x010f00,
-               .muxsel         = {2, 3, 0, 0},
-               .audiomux       = {0x10000, 0, 0x10000, 0, 0, 0},
+               .muxsel         = {2, 3, 0, 0 },
+               .audiomux       = {0x10000, 0, 0x10000, 0, 0, 0 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_SHARP_2U5JF5540_NTSC,
@@ -1487,7 +1487,7 @@ struct tvcard bttv_tvcards[] = {
                .audiomux       = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff},
                /* tvtuner, radio,   external,internal, mute,  stereo
                * tuner, Composit, SVid, Composit-on-Svid-adapter */
-               .muxsel         = { 2, 3 ,0 ,1},
+               .muxsel         = { 2, 3 ,0 ,1 },
                .tuner_type     = TUNER_MT2032,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
@@ -1515,8 +1515,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 15,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 0, 0, 11, 7, 13, 0}, /* TV and Radio with same GPIO ! */
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0, 0, 11, 7, 13, 0 }, /* TV and Radio with same GPIO ! */
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = 25,
@@ -1537,7 +1537,7 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 0,
                .tuner          = -1,
                .svhs           = 2,
-               .muxsel         = { 2, 3, 1, 1}, /* AV1, AV2, SVHS, CVid adapter on SVHS */
+               .muxsel         = { 2, 3, 1, 1 }, /* AV1, AV2, SVHS, CVid adapter on SVHS */
                .pll            = PLL_28,
                .no_msp34xx     = 1,
                .tuner_type     = UNSET,
@@ -1583,7 +1583,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1,
                .svhs           = 4,
                .gpiomask       = 0,
-               .muxsel         = { 2, 3, 1, 0, 0},
+               .muxsel         = { 2, 3, 1, 0, 0 },
                .audiomux       = { 0 },
                .needs_tvaudio  = 0,
                .tuner_type     = -1,
@@ -1696,7 +1696,7 @@ struct tvcard bttv_tvcards[] = {
                .name           = "DSP Design TCVIDEO",
                .video_inputs   = 4,
                .svhs           = -1,
-               .muxsel         = { 2, 3, 1, 0},
+               .muxsel         = { 2, 3, 1, 0 },
                .pll            = PLL_28,
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
@@ -1710,7 +1710,7 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 1,
                .tuner          = 0,
                .svhs           = 2,
-               .muxsel         = { 2, 0, 1, 1},
+               .muxsel         = { 2, 0, 1, 1 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = -1,
@@ -1727,7 +1727,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x0f0f80,
-               .muxsel         = {2, 3, 1, 0},
+               .muxsel         = {2, 3, 1, 0 },
                .audiomux       = {0x030000, 0x010000, 0, 0, 0x020000, 0},
                .no_msp34xx     = 1,
                .pll            = PLL_28,
@@ -1944,7 +1944,7 @@ struct tvcard bttv_tvcards[] = {
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
                .no_tda7432     = 1,
-               .muxsel         = { 3, 0, 1, 2},
+               .muxsel         = { 3, 0, 1, 2 },
                .pll            = PLL_28,
                .no_gpioirq     = 1,
                .has_dvb        = 1,
@@ -1957,7 +1957,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 3,
                .gpiomask       = 2,
                /* TV, Comp1, Composite over SVID con, SVID */
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 2, 2, 0, 0, 0 },
                .pll            = PLL_28,
                .has_radio      = 1,
@@ -2074,7 +2074,7 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 1,
                .tuner          = 0,
                .svhs           = 2,
-               .muxsel         = { 2, 3, 1, 1}, /* Tuner, CVid, SVid, CVid over SVid connector */
+               .muxsel         = { 2, 3, 1, 1 }, /* Tuner, CVid, SVid, CVid over SVid connector */
                .gpiomask       = 0,
                .no_tda9875     = 1,
                .no_tda7432     = 1,
@@ -2128,7 +2128,7 @@ struct tvcard bttv_tvcards[] = {
                .video_inputs   = 1,
                .tuner          = -1,
                .svhs           = -1,
-               .muxsel         = { 2, 3, 1, 0},
+               .muxsel         = { 2, 3, 1, 0 },
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
                .no_tda7432     = 1,
@@ -2166,7 +2166,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1, /* card has no tuner */
                .svhs           = 3,
                .gpiomask       = 0x00,
-               .muxsel         = { 2, 3, 1, 0},
+               .muxsel         = { 2, 3, 1, 0 },
                .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
@@ -2181,7 +2181,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1, /* card has no tuner */
                .svhs           = 3,
                .gpiomask       = 0x00,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
@@ -2268,7 +2268,7 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 1,
                .tuner          = 0,
                .svhs           = 2,
-               .muxsel         = { 2, 3, 1, 0},
+               .muxsel         = { 2, 3, 1, 0 },
                .tuner_type     = TUNER_PHILIPS_ATSC,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
@@ -2291,7 +2291,7 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 0,
                .svhs           = 1,
                .tuner          = -1,
-               .muxsel         = { 3, 1, 1, 3}, /* Vid In, SVid In, Vid over SVid in connector */
+               .muxsel         = { 3, 1, 1, 3 }, /* Vid In, SVid In, Vid over SVid in connector */
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
                .no_tda7432     = 1,
@@ -2307,8 +2307,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 3,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 1, 1, 1, 1, 0},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 1, 1, 1, 1, 0 },
                .needs_tvaudio  = 1,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -2327,7 +2327,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
                .pll            = PLL_28,
-               .muxsel         = { 2, 2, 2, 2},
+               .muxsel         = { 2, 2, 2, 2 },
                .gpiomask       = 0x3F,
                .muxsel_hook    = gvc1100_muxsel,
        },
@@ -2338,8 +2338,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x008007,
-               .muxsel         = {2, 3, 0, 0},
-               .audiomux       = {0, 0, 0, 0, 0x000003, 0},
+               .muxsel         = { 2, 3, 0, 0 },
+               .audiomux       = { 0, 0, 0, 0, 0x000003, 0 },
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
                .tuner_addr     = ADDR_UNSET,
@@ -2374,7 +2374,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .needs_tvaudio  = 0,
                .gpiomask       = 0x68,
-               .muxsel         = { 2, 3, 1},
+               .muxsel         = { 2, 3, 1 },
                .audiomux       = { 0x68, 0x68, 0x61, 0x61, 0x00 },
                .pll            = PLL_28,
        },
@@ -2433,7 +2433,7 @@ struct tvcard bttv_tvcards[] = {
                .svhs           = 2,
                .gpiomask       = 0x0000000f,
                .muxsel         = { 2, 1, 1 },
-               .audiomux       = { 0x02, 0x00, 0x00, 0x00, 0x00},
+               .audiomux       = { 0x02, 0x00, 0x00, 0x00, 0x00 },
                .tuner_type     = TUNER_TEMIC_PAL,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
@@ -2466,7 +2466,7 @@ struct tvcard bttv_tvcards[] = {
                .video_inputs   = 2,
                .tuner          = -1,
                .svhs           = 1,
-               .muxsel         = { 3, 1, 2, 0}, /* Comp0, S-Video, ?, ? */
+               .muxsel         = { 3, 1, 2, 0 }, /* Comp0, S-Video, ?, ? */
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
                .no_tda7432     = 1,
@@ -2523,8 +2523,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = -1,
                .gpiomask       = 0xFF,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 2, 0, 0, 0, 10},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 2, 0, 0, 0, 10 },
                .needs_tvaudio  = 0,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_PAL,
@@ -2557,8 +2557,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x3f,
-               .muxsel         = {2, 3, 1, 0},
-               .audiomux       = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31},
+               .muxsel         = {2, 3, 1, 0 },
+               .audiomux       = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31 },
                .no_msp34xx     = 1,
                .pll            = PLL_28,
                .tuner_type     = TUNER_PHILIPS_NTSC_M,
@@ -2576,12 +2576,12 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 1,
                .tuner          = 0,
                .svhs           = 2,
-               .muxsel         = { 2, 3, 1, 0},
+               .muxsel         = { 2, 3, 1, 0 },
                .tuner_type     = TUNER_PHILIPS_NTSC,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
                .gpiomask       = 0x008007,
-               .audiomux       = { 0, 0x000001,0,0, 0},
+               .audiomux       = { 0, 0x000001,0,0, 0 },
                .needs_tvaudio  = 1,
                .has_radio      = 1,
        },
@@ -2672,7 +2672,7 @@ struct tvcard bttv_tvcards[] = {
                .audio_inputs   = 1,
                .tuner          = 0,
                .svhs           = 2,
-               .muxsel         = { 2, 3, 1, 0},
+               .muxsel         = { 2, 3, 1, 0 },
                .tuner_type     = -1,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
@@ -2706,7 +2706,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x01fe00,
-               .muxsel         = { 2, 3, 1, 1},
+               .muxsel         = { 2, 3, 1, 1 },
                .audiomux       = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
@@ -2794,8 +2794,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 15,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = {2,0,0,0,1},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 2, 0, 0, 0, 1 },
                .needs_tvaudio  = 1,
                .pll            = PLL_28,
                .tuner_type     = 2,
@@ -2810,8 +2810,8 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = 0,
                .svhs           = 2,
                .gpiomask       = 0x108007,
-               .muxsel         = { 2, 3, 1, 1},
-               .audiomux       = { 100000, 100002, 100002, 100000},
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 100000, 100002, 100002, 100000 },
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
                .no_tda7432     = 1,
@@ -2828,7 +2828,7 @@ struct tvcard bttv_tvcards[] = {
                .tuner          = -1,
                .svhs           = -1,
                .gpiomask       = 0x0f, /* old: 7 */
-               .muxsel         = { 0, 1, 3, 2}, /* Composite 0-3 */
+               .muxsel         = { 0, 1, 3, 2 }, /* Composite 0-3 */
                .no_msp34xx     = 1,
                .no_tda9875     = 1,
                .no_tda7432     = 1,
@@ -2836,6 +2836,29 @@ struct tvcard bttv_tvcards[] = {
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
        },
+       [BTTV_BOARD_MACHTV_MAGICTV] = {
+               /* Julian Calaby <julian.calaby@gmail.com>
+                * Slightly different from original MachTV definition (0x60)
+
+                * FIXME: RegSpy says gpiomask should be "0x001c800f", but it
+                * stuffs up remote chip. Bug is a pin on the jaecs is not set
+                * properly (methinks) causing no keyup bits being set */
+
+               .name           = "MagicTV", /* rebranded MachTV */
+               .video_inputs   = 3,
+               .audio_inputs   = 1,
+               .tuner          = 0,
+               .svhs           = 2,
+               .gpiomask       = 7,
+               .muxsel         = { 2, 3, 1, 1 },
+               .audiomux       = { 0, 1, 2, 3, 4 },
+               .tuner_type     = TUNER_TEMIC_4009FR5_PAL,
+               .tuner_addr     = ADDR_UNSET,
+               .radio_addr     = ADDR_UNSET,
+               .pll            = PLL_28,
+               .has_radio      = 1,
+               .has_remote     = 1,
+       },
 };
 
 static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
index 575ce8b8e714d995a92c2f6f0daa53c09e6b2dac..d64accc17b0ef7854438845f6b4cb49096988e89 100644 (file)
@@ -64,10 +64,9 @@ int bttv_sub_add_device(struct bttv_core *core, char *name)
        struct bttv_sub_device *sub;
        int err;
 
-       sub = kmalloc(sizeof(*sub),GFP_KERNEL);
+       sub = kzalloc(sizeof(*sub),GFP_KERNEL);
        if (NULL == sub)
                return -ENOMEM;
-       memset(sub,0,sizeof(*sub));
 
        sub->core        = core;
        sub->dev.parent  = &core->pci->dev;
index 12197f1b27578a7957dac30f78613f4f1b81ae55..221b36e7f3922d0cac81da1ae06490a2a0d50cb3 100644 (file)
@@ -583,6 +583,12 @@ int bttv_input_init(struct bttv *btv)
                btv->custom_irq = bttv_rc5_irq;
                ir->rc5_gpio = 1;
                break;
+       case BTTV_BOARD_MACHTV_MAGICTV:
+               ir_codes         = ir_codes_apac_viewcomp;
+               ir->mask_keycode = 0x001F00;
+               ir->mask_keyup   = 0x004000;
+               ir->polling      = 50; /* ms */
+               break;
        }
        if (NULL == ir_codes) {
                dprintk(KERN_INFO "Ooops: IR config error [card=%d]\n",btv->c.type);
index 9feaa6bab2074906a374e4aecb2493b749a2c598..e370d74f2a1b1f50a17aaa0b4d8b75f6cdb7ab8e 100644 (file)
 #define BTTV_BOARD_ASOUND_SKYEYE          0x8d
 #define BTTV_BOARD_SABRENT_TVFM           0x8e
 #define BTTV_BOARD_HAUPPAUGE_IMPACTVCB     0x8f
+#define BTTV_BOARD_MACHTV_MAGICTV          0x90
 
 /* i2c address list */
 #define I2C_TSA5522        0xc2
index 6194b01255768484e066e2d7fc7f273938d6c60b..297c32ab51e35bdd35bc95c0a39bc0e58096cfe5 100644 (file)
 #include <linux/videodev2.h>
 #include <linux/module.h>
 #include <linux/smp_lock.h>
+#include <media/v4l2-common.h>
 
 #ifdef CONFIG_COMPAT
+
+
 struct video_tuner32 {
        compat_int_t tuner;
        char name[32];
@@ -30,27 +33,29 @@ struct video_tuner32 {
 
 static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
 {
-       if(get_user(kp->tuner, &up->tuner))
+       if(!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) ||
+               get_user(kp->tuner, &up->tuner) ||
+               copy_from_user(kp->name, up->name, 32) ||
+               get_user(kp->rangelow, &up->rangelow) ||
+               get_user(kp->rangehigh, &up->rangehigh) ||
+               get_user(kp->flags, &up->flags) ||
+               get_user(kp->mode, &up->mode) ||
+               get_user(kp->signal, &up->signal))
                return -EFAULT;
-       __copy_from_user(kp->name, up->name, 32);
-       __get_user(kp->rangelow, &up->rangelow);
-       __get_user(kp->rangehigh, &up->rangehigh);
-       __get_user(kp->flags, &up->flags);
-       __get_user(kp->mode, &up->mode);
-       __get_user(kp->signal, &up->signal);
        return 0;
 }
 
 static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up)
 {
-       if(put_user(kp->tuner, &up->tuner))
-               return -EFAULT;
-       __copy_to_user(up->name, kp->name, 32);
-       __put_user(kp->rangelow, &up->rangelow);
-       __put_user(kp->rangehigh, &up->rangehigh);
-       __put_user(kp->flags, &up->flags);
-       __put_user(kp->mode, &up->mode);
-       __put_user(kp->signal, &up->signal);
+       if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) ||
+               put_user(kp->tuner, &up->tuner) ||
+               copy_to_user(up->name, kp->name, 32) ||
+               put_user(kp->rangelow, &up->rangelow) ||
+               put_user(kp->rangehigh, &up->rangehigh) ||
+               put_user(kp->flags, &up->flags) ||
+               put_user(kp->mode, &up->mode) ||
+               put_user(kp->signal, &up->signal))
+                       return -EFAULT;
        return 0;
 }
 
@@ -63,18 +68,19 @@ static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __u
 {
        u32 tmp;
 
-       if (get_user(tmp, &up->base))
-               return -EFAULT;
+       if (!access_ok(VERIFY_READ, up, sizeof(struct video_buffer32)) ||
+               get_user(tmp, &up->base) ||
+               get_user(kp->height, &up->height) ||
+               get_user(kp->width, &up->width) ||
+               get_user(kp->depth, &up->depth) ||
+               get_user(kp->bytesperline, &up->bytesperline))
+                       return -EFAULT;
 
        /* This is actually a physical address stored
         * as a void pointer.
         */
        kp->base = (void *)(unsigned long) tmp;
 
-       __get_user(kp->height, &up->height);
-       __get_user(kp->width, &up->width);
-       __get_user(kp->depth, &up->depth);
-       __get_user(kp->bytesperline, &up->bytesperline);
        return 0;
 }
 
@@ -82,12 +88,13 @@ static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __u
 {
        u32 tmp = (u32)((unsigned long)kp->base);
 
-       if(put_user(tmp, &up->base))
-               return -EFAULT;
-       __put_user(kp->height, &up->height);
-       __put_user(kp->width, &up->width);
-       __put_user(kp->depth, &up->depth);
-       __put_user(kp->bytesperline, &up->bytesperline);
+       if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) ||
+               put_user(tmp, &up->base) ||
+               put_user(kp->height, &up->height) ||
+               put_user(kp->width, &up->width) ||
+               put_user(kp->depth, &up->depth) ||
+               put_user(kp->bytesperline, &up->bytesperline))
+                       return -EFAULT;
        return 0;
 }
 
@@ -121,14 +128,15 @@ static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 /* You get back everything except the clips... */
 static int put_video_window32(struct video_window *kp, struct video_window32 __user *up)
 {
-       if(put_user(kp->x, &up->x))
-               return -EFAULT;
-       __put_user(kp->y, &up->y);
-       __put_user(kp->width, &up->width);
-       __put_user(kp->height, &up->height);
-       __put_user(kp->chromakey, &up->chromakey);
-       __put_user(kp->flags, &up->flags);
-       __put_user(kp->clipcount, &up->clipcount);
+       if(!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) ||
+               put_user(kp->x, &up->x) ||
+               put_user(kp->y, &up->y) ||
+               put_user(kp->width, &up->width) ||
+               put_user(kp->height, &up->height) ||
+               put_user(kp->chromakey, &up->chromakey) ||
+               put_user(kp->flags, &up->flags) ||
+               put_user(kp->clipcount, &up->clipcount))
+                       return -EFAULT;
        return 0;
 }
 
@@ -150,11 +158,12 @@ struct v4l2_window32
 
 static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
 {
-       if (copy_from_user(&kp->w, &up->w, sizeof(up->w)))
-               return -EFAULT;
-       __get_user(kp->field, &up->field);
-       __get_user(kp->chromakey, &up->chromakey);
-       __get_user(kp->clipcount, &up->clipcount);
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_window32)) ||
+               copy_from_user(&kp->w, &up->w, sizeof(up->w)) ||
+               get_user(kp->field, &up->field) ||
+               get_user(kp->chromakey, &up->chromakey) ||
+               get_user(kp->clipcount, &up->clipcount))
+                       return -EFAULT;
        if (kp->clipcount > 2048)
                return -EINVAL;
        if (kp->clipcount) {
@@ -165,7 +174,9 @@ static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
                kclips = compat_alloc_user_space(n * sizeof(struct v4l2_clip));
                kp->clips = kclips;
                while (--n >= 0) {
-                       copy_from_user(&kclips->c, &uclips->c, sizeof(uclips->c));
+                       if (!access_ok(VERIFY_READ, &uclips->c, sizeof(uclips->c)) ||
+                               copy_from_user(&kclips->c, &uclips->c, sizeof(uclips->c)))
+                               return -EFAULT;
                        kclips->next = n ? kclips + 1 : 0;
                        uclips += 1;
                        kclips += 1;
@@ -177,32 +188,45 @@ static int get_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user
 
 static int put_v4l2_window32(struct v4l2_window *kp, struct v4l2_window32 __user *up)
 {
-       if (copy_to_user(&up->w, &kp->w, sizeof(up->w)))
-               return -EFAULT;
-       __put_user(kp->field, &up->field);
-       __put_user(kp->chromakey, &up->chromakey);
-       __put_user(kp->clipcount, &up->clipcount);
+       if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_window32)) ||
+               copy_to_user(&up->w, &kp->w, sizeof(up->w)) ||
+               put_user(kp->field, &up->field) ||
+               put_user(kp->chromakey, &up->chromakey) ||
+               put_user(kp->clipcount, &up->clipcount))
+                       return -EFAULT;
        return 0;
 }
 
 static inline int get_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
 {
-       return copy_from_user(kp, up, sizeof(struct v4l2_pix_format));
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_pix_format)) ||
+               copy_from_user(kp, up, sizeof(struct v4l2_pix_format)))
+                       return -EFAULT;
+       return 0;
 }
 
 static inline int put_v4l2_pix_format(struct v4l2_pix_format *kp, struct v4l2_pix_format __user *up)
 {
-       return copy_to_user(up, kp, sizeof(struct v4l2_pix_format));
+       if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_pix_format)) ||
+               copy_to_user(up, kp, sizeof(struct v4l2_pix_format)))
+                       return -EFAULT;
+       return 0;
 }
 
 static inline int get_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
 {
-       return copy_from_user(kp, up, sizeof(struct v4l2_vbi_format));
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_vbi_format)) ||
+               copy_from_user(kp, up, sizeof(struct v4l2_vbi_format)))
+                       return -EFAULT;
+       return 0;
 }
 
 static inline int put_v4l2_vbi_format(struct v4l2_vbi_format *kp, struct v4l2_vbi_format __user *up)
 {
-       return copy_to_user(up, kp, sizeof(struct v4l2_vbi_format));
+       if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_vbi_format)) ||
+               copy_to_user(up, kp, sizeof(struct v4l2_vbi_format)))
+                       return -EFAULT;
+       return 0;
 }
 
 struct v4l2_format32
@@ -219,8 +243,9 @@ struct v4l2_format32
 
 static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
 {
-       if(get_user(kp->type, &up->type))
-               return -EFAULT;
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_format32)) ||
+                       get_user(kp->type, &up->type))
+                       return -EFAULT;
        switch (kp->type) {
        case V4L2_BUF_TYPE_VIDEO_CAPTURE:
                return get_v4l2_pix_format(&kp->fmt.pix, &up->fmt.pix);
@@ -237,7 +262,8 @@ static int get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user
 
 static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user *up)
 {
-       if(put_user(kp->type, &up->type))
+       if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_format32)) ||
+               put_user(kp->type, &up->type))
                return -EFAULT;
        switch (kp->type) {
        case V4L2_BUF_TYPE_VIDEO_CAPTURE:
@@ -251,6 +277,23 @@ static int put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __user
        }
 }
 
+static inline int get_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
+{
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard)) ||
+               copy_from_user(kp, up, sizeof(struct v4l2_standard)))
+                       return -EFAULT;
+       return 0;
+
+}
+
+static inline int put_v4l2_standard(struct v4l2_standard *kp, struct v4l2_standard __user *up)
+{
+       if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard)) ||
+               copy_to_user(up, kp, sizeof(struct v4l2_standard)))
+                       return -EFAULT;
+       return 0;
+}
+
 struct v4l2_standard32
 {
        __u32                index;
@@ -264,18 +307,39 @@ struct v4l2_standard32
 static int get_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
 {
        /* other fields are not set by the user, nor used by the driver */
-       return get_user(kp->index, &up->index);
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_standard32)) ||
+               get_user(kp->index, &up->index))
+               return -EFAULT;
+       return 0;
 }
 
 static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 __user *up)
 {
-       if(put_user(kp->index, &up->index))
-               return -EFAULT;
-       __copy_to_user(up->id, &kp->id, sizeof(__u64));
-       __copy_to_user(up->name, kp->name, 24);
-       __put_user(kp->frameperiod, &up->frameperiod);
-       __put_user(kp->framelines, &up->framelines);
-       __copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32));
+       if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) ||
+               put_user(kp->index, &up->index) ||
+               copy_to_user(up->id, &kp->id, sizeof(__u64)) ||
+               copy_to_user(up->name, kp->name, 24) ||
+               copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) ||
+               put_user(kp->framelines, &up->framelines) ||
+               copy_to_user(up->reserved, kp->reserved, 4 * sizeof(__u32)))
+                       return -EFAULT;
+       return 0;
+}
+
+static inline int get_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
+{
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_tuner)) ||
+               copy_from_user(kp, up, sizeof(struct v4l2_tuner)))
+                       return -EFAULT;
+       return 0;
+
+}
+
+static inline int put_v4l2_tuner(struct v4l2_tuner *kp, struct v4l2_tuner __user *up)
+{
+       if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_tuner)) ||
+               copy_to_user(up, kp, sizeof(struct v4l2_tuner)))
+                       return -EFAULT;
        return 0;
 }
 
@@ -304,12 +368,13 @@ struct v4l2_buffer32
 static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up)
 {
 
-       if (get_user(kp->index, &up->index))
-               return -EFAULT;
-       __get_user(kp->type, &up->type);
-       __get_user(kp->flags, &up->flags);
-       __get_user(kp->memory, &up->memory);
-       __get_user(kp->input, &up->input);
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_buffer32)) ||
+               get_user(kp->index, &up->index) ||
+               get_user(kp->type, &up->type) ||
+               get_user(kp->flags, &up->flags) ||
+               get_user(kp->memory, &up->memory) ||
+               get_user(kp->input, &up->input))
+                       return -EFAULT;
        switch(kp->memory) {
        case V4L2_MEMORY_MMAP:
                break;
@@ -317,12 +382,14 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
                {
                unsigned long tmp = (unsigned long)compat_ptr(up->m.userptr);
 
-               __get_user(kp->length, &up->length);
-               __get_user(kp->m.userptr, &tmp);
+               if(get_user(kp->length, &up->length) ||
+                       get_user(kp->m.userptr, &tmp))
+                               return -EFAULT;
                }
                break;
        case V4L2_MEMORY_OVERLAY:
-               __get_user(kp->m.offset, &up->m.offset);
+               if(get_user(kp->m.offset, &up->m.offset))
+                       return -EFAULT;
                break;
        }
        return 0;
@@ -330,32 +397,37 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 
 static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user *up)
 {
-       if (put_user(kp->index, &up->index))
-               return -EFAULT;
-       __put_user(kp->type, &up->type);
-       __put_user(kp->flags, &up->flags);
-       __put_user(kp->memory, &up->memory);
-       __put_user(kp->input, &up->input);
+       if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_buffer32)) ||
+               put_user(kp->index, &up->index) ||
+               put_user(kp->type, &up->type) ||
+               put_user(kp->flags, &up->flags) ||
+               put_user(kp->memory, &up->memory) ||
+               put_user(kp->input, &up->input))
+                       return -EFAULT;
        switch(kp->memory) {
        case V4L2_MEMORY_MMAP:
-               __put_user(kp->length, &up->length);
-               __put_user(kp->m.offset, &up->m.offset);
+               if (put_user(kp->length, &up->length) ||
+                       put_user(kp->m.offset, &up->m.offset))
+                       return -EFAULT;
                break;
        case V4L2_MEMORY_USERPTR:
-               __put_user(kp->length, &up->length);
-               __put_user(kp->m.userptr, &up->m.userptr);
+               if (put_user(kp->length, &up->length) ||
+                       put_user(kp->m.userptr, &up->m.userptr))
+                       return -EFAULT;
                break;
        case V4L2_MEMORY_OVERLAY:
-               __put_user(kp->m.offset, &up->m.offset);
+               if (put_user(kp->m.offset, &up->m.offset))
+                       return -EFAULT;
                break;
        }
-       __put_user(kp->bytesused, &up->bytesused);
-       __put_user(kp->field, &up->field);
-       __put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec);
-       __put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec);
-       __copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode));
-       __put_user(kp->sequence, &up->sequence);
-       __put_user(kp->reserved, &up->reserved);
+       if (put_user(kp->bytesused, &up->bytesused) ||
+               put_user(kp->field, &up->field) ||
+               put_user(kp->timestamp.tv_sec, &up->timestamp.tv_sec) ||
+               put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) ||
+               copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) ||
+               put_user(kp->sequence, &up->sequence) ||
+               put_user(kp->reserved, &up->reserved))
+                       return -EFAULT;
        return 0;
 }
 
@@ -371,11 +443,12 @@ static int get_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
 {
        u32 tmp;
 
-       if (get_user(tmp, &up->base))
-               return -EFAULT;
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_framebuffer32)) ||
+               get_user(tmp, &up->base) ||
+               get_user(kp->capability, &up->capability) ||
+               get_user(kp->flags, &up->flags))
+                       return -EFAULT;
        kp->base = compat_ptr(tmp);
-       __get_user(kp->capability, &up->capability);
-       __get_user(kp->flags, &up->flags);
        get_v4l2_pix_format(&kp->fmt, &up->fmt);
        return 0;
 }
@@ -384,25 +457,46 @@ static int put_v4l2_framebuffer32(struct v4l2_framebuffer *kp, struct v4l2_frame
 {
        u32 tmp = (u32)((unsigned long)kp->base);
 
-       if(put_user(tmp, &up->base))
-               return -EFAULT;
-       __put_user(kp->capability, &up->capability);
-       __put_user(kp->flags, &up->flags);
+       if(!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_framebuffer32)) ||
+               put_user(tmp, &up->base) ||
+               put_user(kp->capability, &up->capability) ||
+               put_user(kp->flags, &up->flags))
+                       return -EFAULT;
        put_v4l2_pix_format(&kp->fmt, &up->fmt);
        return 0;
 }
 
-struct v4l2_input32    /* identical layout, but different size */
+static inline int get_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
 {
-       __u32        index;             /*  Which input */
-       __u8         name[32];          /*  Label */
-       __u32        type;              /*  Type of input */
-       __u32        audioset;          /*  Associated audios (bitfield) */
-       __u32        tuner;             /*  Associated tuner */
-       __u32        std[2];            /* __u64 would get the padding wrong */
-       __u32        status;
-       __u32        reserved[4];
-};
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input) - 4) ||
+               copy_from_user(kp, up, sizeof(struct v4l2_input) - 4))
+                       return -EFAULT;
+       return 0;
+}
+
+static inline int put_v4l2_input32(struct v4l2_input *kp, struct v4l2_input __user *up)
+{
+       if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input) - 4) ||
+               copy_to_user(up, kp, sizeof(struct v4l2_input) - 4))
+                       return -EFAULT;
+       return 0;
+}
+
+static inline int get_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
+{
+       if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_input)) ||
+               copy_from_user(kp, up, sizeof(struct v4l2_input)))
+                       return -EFAULT;
+       return 0;
+}
+
+static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user *up)
+{
+       if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_input)) ||
+               copy_to_user(up, kp, sizeof(struct v4l2_input)))
+                       return -EFAULT;
+       return 0;
+}
 
 #define VIDIOCGTUNER32         _IOWR('v',4, struct video_tuner32)
 #define VIDIOCSTUNER32         _IOW('v',5, struct video_tuner32)
@@ -413,6 +507,8 @@ struct v4l2_input32         /* identical layout, but different size */
 #define VIDIOCGFREQ32          _IOR('v',14, u32)
 #define VIDIOCSFREQ32          _IOW('v',15, u32)
 
+/* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
+#define VIDIOC_ENUMINPUT32     VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4)
 #define VIDIOC_G_FMT32         _IOWR ('V',  4, struct v4l2_format32)
 #define VIDIOC_S_FMT32         _IOWR ('V',  5, struct v4l2_format32)
 #define VIDIOC_QUERYBUF32      _IOWR ('V',  9, struct v4l2_buffer32)
@@ -425,7 +521,6 @@ struct v4l2_input32         /* identical layout, but different size */
 #define VIDIOC_STREAMON32      _IOW  ('V', 18, compat_int_t)
 #define VIDIOC_STREAMOFF32     _IOW  ('V', 19, compat_int_t)
 #define VIDIOC_ENUMSTD32       _IOWR ('V', 25, struct v4l2_standard32)
-#define VIDIOC_ENUMINPUT32     _IOWR ('V', 26, struct v4l2_input32)
 /* VIDIOC_S_CTRL is now _IOWR, but was _IOW */
 #define VIDIOC_S_CTRL32                _IOW  ('V', 28, struct v4l2_control)
 #define VIDIOC_G_INPUT32       _IOR  ('V', 38, compat_int_t)
@@ -444,6 +539,9 @@ static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
        int nclips;
        u32 n;
 
+       if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32)))
+               return -EFAULT;
+
        if (get_user(nclips, &up->clipcount))
                return -EFAULT;
 
@@ -476,7 +574,9 @@ static int do_set_window(struct file *file, unsigned int cmd, unsigned long arg)
                        return -EINVAL;
                for (i = 0; i < nclips; i++, u++, p++) {
                        s32 v;
-                       if (get_user(v, &u->x) ||
+                       if (!access_ok(VERIFY_READ, u, sizeof(struct video_clip32)) ||
+                           !access_ok(VERIFY_WRITE, p, sizeof(struct video_clip32)) ||
+                           get_user(v, &u->x) ||
                            put_user(v, &p->x) ||
                            get_user(v, &u->y) ||
                            put_user(v, &p->y) ||
@@ -502,11 +602,14 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
                struct v4l2_buffer v2b;
                struct v4l2_framebuffer v2fb;
                struct v4l2_standard v2s;
+               struct v4l2_input v2i;
+               struct v4l2_tuner v2t;
                unsigned long vx;
        } karg;
        void __user *up = compat_ptr(arg);
        int compatible_arg = 1;
        int err = 0;
+       int realcmd = cmd;
 
        /* First, convert the command. */
        switch(cmd) {
@@ -527,8 +630,8 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
        case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break;
        case VIDIOC_S_FBUF32: cmd = VIDIOC_S_FBUF; break;
        case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break;
-       case VIDIOC_ENUMSTD32: cmd = VIDIOC_ENUMSTD; break;
-       case VIDIOC_ENUMINPUT32: cmd = VIDIOC_ENUMINPUT; break;
+       case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break;
+       case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break;
        case VIDIOC_S_CTRL32: cmd = VIDIOC_S_CTRL; break;
        case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break;
        case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break;
@@ -577,10 +680,31 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
                break;
 
        case VIDIOC_ENUMSTD:
+               err = get_v4l2_standard(&karg.v2s, up);
+               compatible_arg = 0;
+               break;
+
+       case VIDIOC_ENUMSTD32:
                err = get_v4l2_standard32(&karg.v2s, up);
                compatible_arg = 0;
                break;
 
+       case VIDIOC_ENUMINPUT:
+               err = get_v4l2_input(&karg.v2i, up);
+               compatible_arg = 0;
+               break;
+
+       case VIDIOC_ENUMINPUT32:
+               err = get_v4l2_input32(&karg.v2i, up);
+               compatible_arg = 0;
+               break;
+
+       case VIDIOC_G_TUNER:
+       case VIDIOC_S_TUNER:
+               err = get_v4l2_tuner(&karg.v2t, up);
+               compatible_arg = 0;
+               break;
+
        case VIDIOCGWIN:
        case VIDIOCGFBUF:
        case VIDIOCGFREQ:
@@ -593,12 +717,12 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
                goto out;
 
        if(compatible_arg)
-               err = native_ioctl(file, cmd, (unsigned long)up);
+               err = native_ioctl(file, realcmd, (unsigned long)up);
        else {
                mm_segment_t old_fs = get_fs();
 
                set_fs(KERNEL_DS);
-               err = native_ioctl(file, cmd, (unsigned long)&karg);
+               err = native_ioctl(file, realcmd, (unsigned long)&karg);
                set_fs(old_fs);
        }
        if(err == 0) {
@@ -632,9 +756,26 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
                        break;
 
                case VIDIOC_ENUMSTD:
+                       err = put_v4l2_standard(&karg.v2s, up);
+                       break;
+
+               case VIDIOC_ENUMSTD32:
                        err = put_v4l2_standard32(&karg.v2s, up);
                        break;
 
+               case VIDIOC_G_TUNER:
+               case VIDIOC_S_TUNER:
+                       err = put_v4l2_tuner(&karg.v2t, up);
+                       break;
+
+               case VIDIOC_ENUMINPUT:
+                       err = put_v4l2_input(&karg.v2i, up);
+                       break;
+
+               case VIDIOC_ENUMINPUT32:
+                       err = put_v4l2_input32(&karg.v2i, up);
+                       break;
+
                case VIDIOCGFREQ:
                case VIDIOC_G_INPUT:
                        err = put_user(((u32)karg.vx), (u32 __user *)up);
@@ -679,7 +820,11 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
        case VIDIOC_G_PARM:
        case VIDIOC_G_STD:
        case VIDIOC_S_STD:
+       case VIDIOC_G_TUNER:
+       case VIDIOC_S_TUNER:
+       case VIDIOC_ENUMSTD:
        case VIDIOC_ENUMSTD32:
+       case VIDIOC_ENUMINPUT:
        case VIDIOC_ENUMINPUT32:
        case VIDIOC_G_CTRL:
        case VIDIOC_S_CTRL32:
@@ -718,6 +863,8 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
        case _IOR('v' , BASE_VIDIOCPRIVATE+7, int):
                ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
                break;
+       default:
+               v4l_print_ioctl("compat_ioctl32", cmd);
        }
        return ret;
 }
index 6861d408f1b3c98dc72de086c72c9d08d9621a53..74cff626e044375a467000ae57a64846af4d7e58 100644 (file)
@@ -702,12 +702,11 @@ static int cpia_pp_register(struct parport *port)
                return -ENXIO;
        }
 
-       cam = kmalloc(sizeof(struct pp_cam_entry), GFP_KERNEL);
+       cam = kzalloc(sizeof(struct pp_cam_entry), GFP_KERNEL);
        if (cam == NULL) {
                LOG("failed to allocate camera structure\n");
                return -ENOMEM;
        }
-       memset(cam,0,sizeof(struct pp_cam_entry));
        
        pdev = parport_register_device(port, "cpia_pp", NULL, NULL,
                                       NULL, 0, cam);
index 1439cb752874c23ef5fdf265c73d136f4f4ba895..03275c37c5d330b344e5150d4ae7482942e8ee5a 100644 (file)
@@ -499,14 +499,12 @@ static int cpia_probe(struct usb_interface *intf,
 
        printk(KERN_INFO "USB CPiA camera found\n");
 
-       ucpia = kmalloc(sizeof(*ucpia), GFP_KERNEL);
+       ucpia = kzalloc(sizeof(*ucpia), GFP_KERNEL);
        if (!ucpia) {
                printk(KERN_ERR "couldn't kmalloc cpia struct\n");
                return -ENOMEM;
        }
 
-       memset(ucpia, 0, sizeof(*ucpia));
-
        ucpia->dev = udev;
        ucpia->iface = interface->desc.bInterfaceNumber;
        init_waitqueue_head(&ucpia->wq_stream);
index b421068f7ea30bc3bf778cdd747b1e45284f9fc3..8739c64785ef4a2c73092c9b4c12d64d3fc84305 100644 (file)
@@ -141,11 +141,10 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
 
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver;
@@ -156,7 +155,7 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
        for (i = 1; i <= 7; i++) {
                u8 v = cs53l32a_read(client, i);
 
-               v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
+               v4l_dbg(1, debug, client, "Read Reg %d %02x\n", i, v);
        }
 
        /* Set cs53l32a internal register for Adaptec 2010/2410 setup */
@@ -174,7 +173,7 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
        for (i = 1; i <= 7; i++) {
                u8 v = cs53l32a_read(client, i);
 
-               v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
+               v4l_dbg(1, debug, client, "Read Reg %d %02x\n", i, v);
        }
 
        i2c_attach_client(client);
index d45237d508c45e868dafa4b3afef8103756ea72f..1d75a42629d1e342b35641fc09225f1523143442 100644 (file)
@@ -43,9 +43,9 @@ MODULE_LICENSE("GPL");
 static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
 
 
-int debug = 0;
+int cx25840_debug = 0;
 
-module_param(debug, bool, 0644);
+module_param_named(debug,cx25840_debug, int, 0644);
 
 MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]");
 
@@ -265,7 +265,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
                           vid_input <= CX25840_COMPOSITE8);
        u8 reg;
 
-       v4l_dbg(1, client, "decoder set video input %d, audio input %d\n",
+       v4l_dbg(1, cx25840_debug, client, "decoder set video input %d, audio input %d\n",
                        vid_input, aud_input);
 
        if (is_composite) {
@@ -533,7 +533,7 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
                else
                        filter = 3;
 
-               v4l_dbg(1, client, "decoder set size %dx%d -> scale  %ux%u\n",
+               v4l_dbg(1, cx25840_debug, client, "decoder set size %dx%d -> scale  %ux%u\n",
                            pix->width, pix->height, HSC, VSC);
 
                /* HSCALE=HSC */
@@ -687,13 +687,13 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
                return cx25840_audio(client, cmd, arg);
 
        case VIDIOC_STREAMON:
-               v4l_dbg(1, client, "enable output\n");
+               v4l_dbg(1, cx25840_debug, client, "enable output\n");
                cx25840_write(client, 0x115, 0x8c);
                cx25840_write(client, 0x116, 0x07);
                break;
 
        case VIDIOC_STREAMOFF:
-               v4l_dbg(1, client, "disable output\n");
+               v4l_dbg(1, cx25840_debug, client, "disable output\n");
                cx25840_write(client, 0x115, 0x00);
                cx25840_write(client, 0x116, 0x00);
                break;
@@ -862,17 +862,16 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
        if (!i2c_check_functionality(adapter, I2C_FUNC_I2C))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
 
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_cx25840;
        snprintf(client->name, sizeof(client->name) - 1, "cx25840");
 
-       v4l_dbg(1, client, "detecting cx25840 client on address 0x%x\n", address << 1);
+       v4l_dbg(1, cx25840_debug, client, "detecting cx25840 client on address 0x%x\n", address << 1);
 
        device_id = cx25840_read(client, 0x101) << 8;
        device_id |= cx25840_read(client, 0x100);
@@ -880,7 +879,7 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
        /* The high byte of the device ID should be
         * 0x84 if chip is present */
        if ((device_id & 0xff00) != 0x8400) {
-               v4l_dbg(1, client, "cx25840 not found\n");
+               v4l_dbg(1, cx25840_debug, client, "cx25840 not found\n");
                kfree(client);
                return 0;
        }
index a490621193132bbf294f5211c279f28542a20fc0..a502a4d6e4ae0ea68e01e9ed7875217d2d514865 100644 (file)
@@ -1539,10 +1539,9 @@ static int mpeg_open(struct inode *inode, struct file *file)
        dprintk(1,"open minor=%d\n",minor);
 
        /* allocate + initialize per filehandle data */
-       fh = kmalloc(sizeof(*fh),GFP_KERNEL);
+       fh = kzalloc(sizeof(*fh),GFP_KERNEL);
        if (NULL == fh)
                return -ENOMEM;
-       memset(fh,0,sizeof(*fh));
        file->private_data = fh;
        fh->dev      = dev;
 
@@ -1678,10 +1677,9 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev,
                goto fail_core;
 
        err = -ENOMEM;
-       dev = kmalloc(sizeof(*dev),GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev),GFP_KERNEL);
        if (NULL == dev)
                goto fail_core;
-       memset(dev,0,sizeof(*dev));
        dev->pci = pci_dev;
        dev->core = core;
        dev->width = 720;
index a76d54503b6f45d094bcf0fe8eb68b5a3b387c55..ad2f565f522c009fc16cff2cc9f3d24ceebdc522 100644 (file)
@@ -1244,6 +1244,11 @@ struct cx88_subid cx88_subids[] = {
                .subvendor = 0x18ac,
                .subdevice = 0xdb50,
                .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL,
+       },{
+               .subvendor = 0x18ac,
+               .subdevice = 0xdb11,
+               .card      = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS,
+               /* Re-branded DViCO: UltraView DVB-T Plus */
        },
 };
 const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
index 9975be1aca38979340b70a7a061d56702f7a1b41..194446f28c55c366b82a4f91f38222d0c5c9edfa 100644 (file)
@@ -1050,11 +1050,10 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
                up(&devlist);
                return core;
        }
-       core = kmalloc(sizeof(*core),GFP_KERNEL);
+       core = kzalloc(sizeof(*core),GFP_KERNEL);
        if (NULL == core)
                goto fail_unlock;
 
-       memset(core,0,sizeof(*core));
        atomic_inc(&core->refcount);
        core->pci_bus  = pci->bus->number;
        core->pci_slot = PCI_SLOT(pci->devfn);
index 42c012aaa849de3314182fce35a435f8a9f9043f..e48aa3f6e50012a1c2e854a9d96943e11337038d 100644 (file)
@@ -657,10 +657,9 @@ static int __devinit dvb_probe(struct pci_dev *pci_dev,
                goto fail_core;
 
        err = -ENOMEM;
-       dev = kmalloc(sizeof(*dev),GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev),GFP_KERNEL);
        if (NULL == dev)
                goto fail_core;
-       memset(dev,0,sizeof(*dev));
        dev->pci = pci_dev;
        dev->core = core;
 
index 286c85b6bdf9a507232eadd2a44bc0e287067ecb..da2ad5c4b553e4b99c9a84882b221b5f2847e0e7 100644 (file)
@@ -697,6 +697,7 @@ void cx88_ir_irq(struct cx88_core *core)
        case CX88_BOARD_HAUPPAUGE_DVB_T1:
        case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
        case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
+       case CX88_BOARD_HAUPPAUGE_HVR1100:
                ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
                ir_dprintk("biphase decoded: %x\n", ircode);
                if ((ircode & 0xfffff000) != 0x3000)
index 9a02515fe18bc440b6c7a26fc32faf9e7f03ec14..073494ceab0fbe17d59357d4eed19c9742cada9a 100644 (file)
@@ -750,10 +750,9 @@ static int video_open(struct inode *inode, struct file *file)
                minor,radio,v4l2_type_names[type]);
 
        /* allocate + initialize per filehandle data */
-       fh = kmalloc(sizeof(*fh),GFP_KERNEL);
+       fh = kzalloc(sizeof(*fh),GFP_KERNEL);
        if (NULL == fh)
                return -ENOMEM;
-       memset(fh,0,sizeof(*fh));
        file->private_data = fh;
        fh->dev      = dev;
        fh->radio    = radio;
@@ -1809,10 +1808,9 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
        struct cx88_core *core;
        int err;
 
-       dev = kmalloc(sizeof(*dev),GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev),GFP_KERNEL);
        if (NULL == dev)
                return -ENOMEM;
-       memset(dev,0,sizeof(*dev));
 
        /* pci init */
        dev->pci = pci_dev;
index da9481198c5305c4a916d858c046f7d1eb0fd9f7..2831bdd120573b911a5e719670db3be550bbb205 100644 (file)
@@ -94,12 +94,11 @@ static int dpc_probe(struct saa7146_dev* dev)
        struct i2c_client *client;
        struct list_head *item;
 
-       dpc = (struct dpc*)kmalloc(sizeof(struct dpc), GFP_KERNEL);
+       dpc = kzalloc(sizeof(struct dpc), GFP_KERNEL);
        if( NULL == dpc ) {
                printk("dpc_v4l2.o: dpc_probe: not enough kernel memory.\n");
                return -ENOMEM;
        }
-       memset(dpc, 0x0, sizeof(struct dpc));   
 
        /* FIXME: enable i2c-port pins, video-port-pins
           video port pins should be enabled here ?! */
index fdc255918ddef1e11d8416cb170ceb1baecd1a3f..3323dffe26a479323be61337e1ae51a54b6bb796 100644 (file)
@@ -1861,12 +1861,11 @@ static int em28xx_usb_probe(struct usb_interface *interface,
        }
 
        /* allocate memory for our device state and initialize it */
-       dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (dev == NULL) {
                em28xx_err(DRIVER_NAME ": out of memory!\n");
                return -ENOMEM;
        }
-       memset(dev, 0, sizeof(*dev));
 
        /* compute alternate max packet sizes */
        uif = udev->actconfig->interface[0];
index c9b00eafefde16415d6ebb3bb4a9dca36e93b7dc..e7bbeb11553d5d72ef17337d9dcac0a932c9f8bf 100644 (file)
@@ -240,12 +240,11 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
 
        DEB_EE((".\n"));
 
-       hexium = (struct hexium *) kmalloc(sizeof(struct hexium), GFP_KERNEL);
+       hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
        if (NULL == hexium) {
                printk("hexium_gemini: not enough kernel memory in hexium_attach().\n");
                return -ENOMEM;
        }
-       memset(hexium, 0x0, sizeof(struct hexium));
        dev->ext_priv = hexium;
 
        /* enable i2c-port pins */
index 42a9414155c370dfc3afd8784c347317f40a648e..0b6c2096ec66bb367eeb0928e4686eec23e68e07 100644 (file)
@@ -224,12 +224,11 @@ static int hexium_probe(struct saa7146_dev *dev)
                return -EFAULT;
        }
 
-       hexium = (struct hexium *) kmalloc(sizeof(struct hexium), GFP_KERNEL);
+       hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
        if (NULL == hexium) {
                printk("hexium_orion: hexium_probe: not enough kernel memory.\n");
                return -ENOMEM;
        }
-       memset(hexium, 0x0, sizeof(struct hexium));
 
        /* enable i2c-port pins */
        saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
index bb5cbecffcc3e5e4c2320f8b946ee2894f522ffb..7420b79e987abe775d81a5135d9d8e2657a227f2 100644 (file)
@@ -289,18 +289,15 @@ static int indycam_attach(struct i2c_adapter *adap, int addr, int kind)
        printk(KERN_INFO "SGI IndyCam driver version %s\n",
               INDYCAM_MODULE_VERSION);
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (!client)
                return -ENOMEM;
-       camera = kmalloc(sizeof(struct indycam), GFP_KERNEL);
+       camera = kzalloc(sizeof(struct indycam), GFP_KERNEL);
        if (!camera) {
                err = -ENOMEM;
                goto out_free_client;
        }
 
-       memset(client, 0, sizeof(struct i2c_client));
-       memset(camera, 0, sizeof(struct indycam));
-
        client->addr = addr;
        client->adapter = adap;
        client->driver = &i2c_driver_indycam;
index aa8c556b6ba1f2e9ff413a33248c6302791515ed..9b05a0ab776dbe591f4a1613da1a2ff8b42ff2f0 100644 (file)
@@ -66,26 +66,26 @@ MODULE_LICENSE("GPL");
 
 /* module parameters */
 static int opmode   = OPMODE_AUTO;
-int debug    = 0;    /* debug output */
-int once     = 0;    /* no continous stereo monitoring */
-int amsound  = 0;    /* hard-wire AM sound at 6.5 Hz (france),
+int msp_debug    = 0;    /* msp_debug output */
+int msp_once     = 0;    /* no continous stereo monitoring */
+int msp_amsound  = 0;    /* hard-wire AM sound at 6.5 Hz (france),
                               the autoscan seems work well only with FM... */
-int standard = 1;    /* Override auto detect of audio standard, if needed. */
-int dolby    = 0;
+int msp_standard = 1;    /* Override auto detect of audio msp_standard, if needed. */
+int msp_dolby    = 0;
 
-int stereo_threshold = 0x190; /* a2 threshold for stereo/bilingual
+int msp_stereo_thresh = 0x190; /* a2 threshold for stereo/bilingual
                                        (msp34xxg only) 0x00a0-0x03c0 */
 
 /* read-only */
 module_param(opmode,           int, 0444);
 
 /* read-write */
-module_param(once,             bool, 0644);
-module_param(debug,            int, 0644);
-module_param(stereo_threshold, int, 0644);
-module_param(standard,         int, 0644);
-module_param(amsound,          bool, 0644);
-module_param(dolby,            bool, 0644);
+module_param_named(once,msp_once,                      bool, 0644);
+module_param_named(debug,msp_debug,                    int,  0644);
+module_param_named(stereo_threshold,msp_stereo_thresh, int,  0644);
+module_param_named(standard,msp_standard,              int,  0644);
+module_param_named(amsound,msp_amsound,                bool, 0644);
+module_param_named(dolby,msp_dolby,                    bool, 0644);
 
 MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect");
 MODULE_PARM_DESC(once, "No continuous stereo monitoring");
@@ -127,7 +127,7 @@ int msp_reset(struct i2c_client *client)
                { client->addr, I2C_M_RD, 2, read  },
        };
 
-       v4l_dbg(3, client, "msp_reset\n");
+       v4l_dbg(3, msp_debug, client, "msp_reset\n");
        if (i2c_transfer(client->adapter, &reset[0], 1) != 1 ||
            i2c_transfer(client->adapter, &reset[1], 1) != 1 ||
            i2c_transfer(client->adapter, test, 2) != 2) {
@@ -165,7 +165,7 @@ static int msp_read(struct i2c_client *client, int dev, int addr)
                return -1;
        }
        retval = read[0] << 8 | read[1];
-       v4l_dbg(3, client, "msp_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval);
+       v4l_dbg(3, msp_debug, client, "msp_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval);
        return retval;
 }
 
@@ -190,7 +190,7 @@ static int msp_write(struct i2c_client *client, int dev, int addr, int val)
        buffer[3] = val  >> 8;
        buffer[4] = val  &  0xff;
 
-       v4l_dbg(3, client, "msp_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val);
+       v4l_dbg(3, msp_debug, client, "msp_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val);
        for (err = 0; err < 3; err++) {
                if (i2c_master_send(client, buffer, 5) == 5)
                        break;
@@ -273,7 +273,7 @@ void msp_set_scart(struct i2c_client *client, int in, int out)
        } else
                state->acb = 0xf60; /* Mute Input and SCART 1 Output */
 
-       v4l_dbg(1, client, "scart switch: %s => %d (ACB=0x%04x)\n",
+       v4l_dbg(1, msp_debug, client, "scart switch: %s => %d (ACB=0x%04x)\n",
                                                scart_names[in], out, state->acb);
        msp_write_dsp(client, 0x13, state->acb);
 
@@ -285,7 +285,7 @@ void msp_set_mute(struct i2c_client *client)
 {
        struct msp_state *state = i2c_get_clientdata(client);
 
-       v4l_dbg(1, client, "mute audio\n");
+       v4l_dbg(1, msp_debug, client, "mute audio\n");
        msp_write_dsp(client, 0x0000, 0);
        msp_write_dsp(client, 0x0007, 1);
        if (state->has_scart2_out_volume)
@@ -303,7 +303,7 @@ void msp_set_audio(struct i2c_client *client)
        if (!state->muted)
                val = (state->volume * 0x7f / 65535) << 8;
 
-       v4l_dbg(1, client, "mute=%s volume=%d\n",
+       v4l_dbg(1, msp_debug, client, "mute=%s volume=%d\n",
                state->muted ? "on" : "off", state->volume);
 
        msp_write_dsp(client, 0x0000, val);
@@ -321,7 +321,7 @@ void msp_set_audio(struct i2c_client *client)
        treble = ((state->treble - 32768) * 0x60 / 65535) << 8;
        loudness = state->loudness ? ((5 * 4) << 8) : 0;
 
-       v4l_dbg(1, client, "balance=%d bass=%d treble=%d loudness=%d\n",
+       v4l_dbg(1, msp_debug, client, "balance=%d bass=%d treble=%d loudness=%d\n",
                state->balance, state->bass, state->treble, state->loudness);
 
        msp_write_dsp(client, 0x0001, bal << 8);
@@ -341,12 +341,12 @@ int msp_modus(struct i2c_client *client)
        struct msp_state *state = i2c_get_clientdata(client);
 
        if (state->radio) {
-               v4l_dbg(1, client, "video mode selected to Radio\n");
+               v4l_dbg(1, msp_debug, client, "video mode selected to Radio\n");
                return 0x0003;
        }
 
        if (state->v4l2_std & V4L2_STD_PAL) {
-               v4l_dbg(1, client, "video mode selected to PAL\n");
+               v4l_dbg(1, msp_debug, client, "video mode selected to PAL\n");
 
 #if 1
                /* experimental: not sure this works with all chip versions */
@@ -357,11 +357,11 @@ int msp_modus(struct i2c_client *client)
 #endif
        }
        if (state->v4l2_std & V4L2_STD_NTSC) {
-               v4l_dbg(1, client, "video mode selected to NTSC\n");
+               v4l_dbg(1, msp_debug, client, "video mode selected to NTSC\n");
                return 0x2003;
        }
        if (state->v4l2_std & V4L2_STD_SECAM) {
-               v4l_dbg(1, client, "video mode selected to SECAM\n");
+               v4l_dbg(1, msp_debug, client, "video mode selected to SECAM\n");
                return 0x0003;
        }
        return 0x0003;
@@ -619,7 +619,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
        u16 *sarg = arg;
        int scart = 0;
 
-       if (debug >= 2)
+       if (msp_debug >= 2)
                v4l_i2c_print_ioctl(client, cmd);
 
        switch (cmd) {
@@ -666,7 +666,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
                if (state->radio)
                        return 0;
                state->radio = 1;
-               v4l_dbg(1, client, "switching to radio mode\n");
+               v4l_dbg(1, msp_debug, client, "switching to radio mode\n");
                state->watch_stereo = 0;
                switch (state->opmode) {
                case OPMODE_MANUAL:
@@ -937,7 +937,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
                if (a->index < 0 || a->index > 2)
                        return -EINVAL;
 
-               v4l_dbg(1, client, "Setting audio out on msp34xx to input %i\n", a->index);
+               v4l_dbg(1, msp_debug, client, "Setting audio out on msp34xx to input %i\n", a->index);
                msp_set_scart(client, state->in_scart, a->index + 1);
 
                break;
@@ -947,7 +947,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
        {
                u32 *a = (u32 *)arg;
 
-               v4l_dbg(1, client, "Setting I2S speed to %d\n", *a);
+               v4l_dbg(1, msp_debug, client, "Setting I2S speed to %d\n", *a);
 
                switch (*a) {
                        case 1024000:
@@ -1041,7 +1041,7 @@ static int msp_suspend(struct device * dev, pm_message_t state)
 {
        struct i2c_client *client = container_of(dev, struct i2c_client, dev);
 
-       v4l_dbg(1, client, "suspend\n");
+       v4l_dbg(1, msp_debug, client, "suspend\n");
        msp_reset(client);
        return 0;
 }
@@ -1050,7 +1050,7 @@ static int msp_resume(struct device * dev)
 {
        struct i2c_client *client = container_of(dev, struct i2c_client, dev);
 
-       v4l_dbg(1, client, "resume\n");
+       v4l_dbg(1, msp_debug, client, "resume\n");
        msp_wake_thread(client);
        return 0;
 }
@@ -1080,7 +1080,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
        snprintf(client->name, sizeof(client->name) - 1, "msp3400");
 
        if (msp_reset(client) == -1) {
-               v4l_dbg(1, client, "msp3400 not found\n");
+               v4l_dbg(1, msp_debug, client, "msp3400 not found\n");
                kfree(client);
                return -1;
        }
@@ -1107,9 +1107,9 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
        state->rev1 = msp_read_dsp(client, 0x1e);
        if (state->rev1 != -1)
                state->rev2 = msp_read_dsp(client, 0x1f);
-       v4l_dbg(1, client, "rev1=0x%04x, rev2=0x%04x\n", state->rev1, state->rev2);
+       v4l_dbg(1, msp_debug, client, "rev1=0x%04x, rev2=0x%04x\n", state->rev1, state->rev2);
        if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) {
-               v4l_dbg(1, client, "not an msp3400 (cannot read chip version)\n");
+               v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n");
                kfree(state);
                kfree(client);
                return -1;
index 2b59b6847535afeec755de3785d0e8efd0aec6b4..2072c3efebb31fb364aa6e2e7625fbb6dd5eceb5 100644 (file)
@@ -168,7 +168,7 @@ void msp3400c_setmode(struct i2c_client *client, int type)
        struct msp_state *state = i2c_get_clientdata(client);
        int i;
 
-       v4l_dbg(1, client, "setmode: %d\n", type);
+       v4l_dbg(1, msp_debug, client, "setmode: %d\n", type);
        state->mode       = type;
        state->audmode    = V4L2_TUNER_MODE_MONO;
        state->rxsubchans = V4L2_TUNER_SUB_MONO;
@@ -191,7 +191,7 @@ void msp3400c_setmode(struct i2c_client *client, int type)
 
        msp_write_dem(client, 0x0056, 0); /*LOAD_REG_1/2*/
 
-       if (dolby) {
+       if (msp_dolby) {
                msp_write_dsp(client, 0x0008, 0x0520); /* I2S1 */
                msp_write_dsp(client, 0x0009, 0x0620); /* I2S2 */
                msp_write_dsp(client, 0x000b, msp3400c_init_data[type].dsp_src);
@@ -221,7 +221,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
                /* this method would break everything, let's make sure
                 * it's never called
                 */
-               v4l_dbg(1, client, "setstereo called with mode=%d instead of set_source (ignored)\n",
+               v4l_dbg(1, msp_debug, client, "setstereo called with mode=%d instead of set_source (ignored)\n",
                     mode);
                return;
        }
@@ -229,7 +229,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
        /* switch demodulator */
        switch (state->mode) {
        case MSP_MODE_FM_TERRA:
-               v4l_dbg(1, client, "FM setstereo: %s\n", strmode[mode]);
+               v4l_dbg(1, msp_debug, client, "FM setstereo: %s\n", strmode[mode]);
                msp3400c_setcarrier(client, state->second, state->main);
                switch (mode) {
                case V4L2_TUNER_MODE_STEREO:
@@ -243,7 +243,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
                }
                break;
        case MSP_MODE_FM_SAT:
-               v4l_dbg(1, client, "SAT setstereo: %s\n", strmode[mode]);
+               v4l_dbg(1, msp_debug, client, "SAT setstereo: %s\n", strmode[mode]);
                switch (mode) {
                case V4L2_TUNER_MODE_MONO:
                        msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));
@@ -262,24 +262,24 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
        case MSP_MODE_FM_NICAM1:
        case MSP_MODE_FM_NICAM2:
        case MSP_MODE_AM_NICAM:
-               v4l_dbg(1, client, "NICAM setstereo: %s\n",strmode[mode]);
+               v4l_dbg(1, msp_debug, client, "NICAM setstereo: %s\n",strmode[mode]);
                msp3400c_setcarrier(client,state->second,state->main);
                if (state->nicam_on)
                        nicam=0x0100;
                break;
        case MSP_MODE_BTSC:
-               v4l_dbg(1, client, "BTSC setstereo: %s\n",strmode[mode]);
+               v4l_dbg(1, msp_debug, client, "BTSC setstereo: %s\n",strmode[mode]);
                nicam=0x0300;
                break;
        case MSP_MODE_EXTERN:
-               v4l_dbg(1, client, "extern setstereo: %s\n",strmode[mode]);
+               v4l_dbg(1, msp_debug, client, "extern setstereo: %s\n",strmode[mode]);
                nicam = 0x0200;
                break;
        case MSP_MODE_FM_RADIO:
-               v4l_dbg(1, client, "FM-Radio setstereo: %s\n",strmode[mode]);
+               v4l_dbg(1, msp_debug, client, "FM-Radio setstereo: %s\n",strmode[mode]);
                break;
        default:
-               v4l_dbg(1, client, "mono setstereo\n");
+               v4l_dbg(1, msp_debug, client, "mono setstereo\n");
                return;
        }
 
@@ -290,7 +290,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
                break;
        case V4L2_TUNER_MODE_MONO:
                if (state->mode == MSP_MODE_AM_NICAM) {
-                       v4l_dbg(1, client, "switching to AM mono\n");
+                       v4l_dbg(1, msp_debug, client, "switching to AM mono\n");
                        /* AM mono decoding is handled by tuner, not MSP chip */
                        /* SCART switching control register */
                        msp_set_scart(client, SCART_MONO, 0);
@@ -304,9 +304,9 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
                src = 0x0010 | nicam;
                break;
        }
-       v4l_dbg(1, client, "setstereo final source/matrix = 0x%x\n", src);
+       v4l_dbg(1, msp_debug, client, "setstereo final source/matrix = 0x%x\n", src);
 
-       if (dolby) {
+       if (msp_dolby) {
                msp_write_dsp(client, 0x0008, 0x0520);
                msp_write_dsp(client, 0x0009, 0x0620);
                msp_write_dsp(client, 0x000a, src);
@@ -327,20 +327,20 @@ static void msp3400c_print_mode(struct i2c_client *client)
        struct msp_state *state = i2c_get_clientdata(client);
 
        if (state->main == state->second) {
-               v4l_dbg(1, client, "mono sound carrier: %d.%03d MHz\n",
+               v4l_dbg(1, msp_debug, client, "mono sound carrier: %d.%03d MHz\n",
                       state->main / 910000, (state->main / 910) % 1000);
        } else {
-               v4l_dbg(1, client, "main sound carrier: %d.%03d MHz\n",
+               v4l_dbg(1, msp_debug, client, "main sound carrier: %d.%03d MHz\n",
                       state->main / 910000, (state->main / 910) % 1000);
        }
        if (state->mode == MSP_MODE_FM_NICAM1 || state->mode == MSP_MODE_FM_NICAM2)
-               v4l_dbg(1, client, "NICAM/FM carrier  : %d.%03d MHz\n",
+               v4l_dbg(1, msp_debug, client, "NICAM/FM carrier  : %d.%03d MHz\n",
                       state->second / 910000, (state->second/910) % 1000);
        if (state->mode == MSP_MODE_AM_NICAM)
-               v4l_dbg(1, client, "NICAM/AM carrier  : %d.%03d MHz\n",
+               v4l_dbg(1, msp_debug, client, "NICAM/AM carrier  : %d.%03d MHz\n",
                       state->second / 910000, (state->second / 910) % 1000);
        if (state->mode == MSP_MODE_FM_TERRA && state->main != state->second) {
-               v4l_dbg(1, client, "FM-stereo carrier : %d.%03d MHz\n",
+               v4l_dbg(1, msp_debug, client, "FM-stereo carrier : %d.%03d MHz\n",
                       state->second / 910000, (state->second / 910) % 1000);
        }
 }
@@ -360,7 +360,7 @@ int autodetect_stereo(struct i2c_client *client)
                val = msp_read_dsp(client, 0x18);
                if (val > 32767)
                        val -= 65536;
-               v4l_dbg(2, client, "stereo detect register: %d\n", val);
+               v4l_dbg(2, msp_debug, client, "stereo detect register: %d\n", val);
                if (val > 4096) {
                        rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;
                } else if (val < -4096) {
@@ -374,7 +374,7 @@ int autodetect_stereo(struct i2c_client *client)
        case MSP_MODE_FM_NICAM2:
        case MSP_MODE_AM_NICAM:
                val = msp_read_dem(client, 0x23);
-               v4l_dbg(2, client, "nicam sync=%d, mode=%d\n",
+               v4l_dbg(2, msp_debug, client, "nicam sync=%d, mode=%d\n",
                        val & 1, (val & 0x1e) >> 1);
 
                if (val & 1) {
@@ -407,7 +407,7 @@ int autodetect_stereo(struct i2c_client *client)
                break;
        case MSP_MODE_BTSC:
                val = msp_read_dem(client, 0x200);
-               v4l_dbg(2, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n",
+               v4l_dbg(2, msp_debug, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n",
                        val,
                        (val & 0x0002) ? "no"     : "yes",
                        (val & 0x0004) ? "no"     : "yes",
@@ -421,13 +421,13 @@ int autodetect_stereo(struct i2c_client *client)
        }
        if (rxsubchans != state->rxsubchans) {
                update = 1;
-               v4l_dbg(1, client, "watch: rxsubchans %d => %d\n",
+               v4l_dbg(1, msp_debug, client, "watch: rxsubchans %d => %d\n",
                        state->rxsubchans,rxsubchans);
                state->rxsubchans = rxsubchans;
        }
        if (newnicam != state->nicam_on) {
                update = 1;
-               v4l_dbg(1, client, "watch: nicam %d => %d\n",
+               v4l_dbg(1, msp_debug, client, "watch: nicam %d => %d\n",
                        state->nicam_on,newnicam);
                state->nicam_on = newnicam;
        }
@@ -452,7 +452,7 @@ static void watch_stereo(struct i2c_client *client)
                        msp3400c_setstereo(client, V4L2_TUNER_MODE_MONO);
        }
 
-       if (once)
+       if (msp_once)
                state->watch_stereo = 0;
 }
 
@@ -464,21 +464,21 @@ int msp3400c_thread(void *data)
        int count, max1,max2,val1,val2, val,this;
 
 
-       v4l_dbg(1, client, "msp3400 daemon started\n");
+       v4l_dbg(1, msp_debug, client, "msp3400 daemon started\n");
        for (;;) {
-               v4l_dbg(2, client, "msp3400 thread: sleep\n");
+               v4l_dbg(2, msp_debug, client, "msp3400 thread: sleep\n");
                msp_sleep(state, -1);
-               v4l_dbg(2, client, "msp3400 thread: wakeup\n");
+               v4l_dbg(2, msp_debug, client, "msp3400 thread: wakeup\n");
 
        restart:
-               v4l_dbg(1, client, "thread: restart scan\n");
+               v4l_dbg(1, msp_debug, client, "thread: restart scan\n");
                state->restart = 0;
                if (kthread_should_stop())
                        break;
 
                if (state->radio || MSP_MODE_EXTERN == state->mode) {
                        /* no carrier scan, just unmute */
-                       v4l_dbg(1, client, "thread: no carrier scan\n");
+                       v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
                        msp_set_audio(client);
                        continue;
                }
@@ -498,11 +498,11 @@ int msp3400c_thread(void *data)
                cd = msp3400c_carrier_detect_main;
                count = ARRAY_SIZE(msp3400c_carrier_detect_main);
 
-               if (amsound && (state->v4l2_std & V4L2_STD_SECAM)) {
+               if (msp_amsound && (state->v4l2_std & V4L2_STD_SECAM)) {
                        /* autodetect doesn't work well with AM ... */
                        max1 = 3;
                        count = 0;
-                       v4l_dbg(1, client, "AM sound override\n");
+                       v4l_dbg(1, msp_debug, client, "AM sound override\n");
                }
 
                for (this = 0; this < count; this++) {
@@ -514,7 +514,7 @@ int msp3400c_thread(void *data)
                                val -= 65536;
                        if (val1 < val)
                                val1 = val, max1 = this;
-                       v4l_dbg(1, client, "carrier1 val: %5d / %s\n", val,cd[this].name);
+                       v4l_dbg(1, msp_debug, client, "carrier1 val: %5d / %s\n", val,cd[this].name);
                }
 
                /* carrier detect pass #2 -- second (stereo) carrier */
@@ -535,7 +535,7 @@ int msp3400c_thread(void *data)
                        break;
                }
 
-               if (amsound && (state->v4l2_std & V4L2_STD_SECAM)) {
+               if (msp_amsound && (state->v4l2_std & V4L2_STD_SECAM)) {
                        /* autodetect doesn't work well with AM ... */
                        cd = NULL;
                        count = 0;
@@ -550,7 +550,7 @@ int msp3400c_thread(void *data)
                                val -= 65536;
                        if (val2 < val)
                                val2 = val, max2 = this;
-                       v4l_dbg(1, client, "carrier2 val: %5d / %s\n", val,cd[this].name);
+                       v4l_dbg(1, msp_debug, client, "carrier2 val: %5d / %s\n", val,cd[this].name);
                }
 
                /* program the msp3400 according to the results */
@@ -627,7 +627,7 @@ int msp3400c_thread(void *data)
                /* unmute */
                msp_set_audio(client);
 
-               if (debug)
+               if (msp_debug)
                        msp3400c_print_mode(client);
 
                /* monitor tv audio mode */
@@ -637,7 +637,7 @@ int msp3400c_thread(void *data)
                        watch_stereo(client);
                }
        }
-       v4l_dbg(1, client, "thread: exit\n");
+       v4l_dbg(1, msp_debug, client, "thread: exit\n");
        return 0;
 }
 
@@ -648,22 +648,22 @@ int msp3410d_thread(void *data)
        struct msp_state *state = i2c_get_clientdata(client);
        int val, i, std;
 
-       v4l_dbg(1, client, "msp3410 daemon started\n");
+       v4l_dbg(1, msp_debug, client, "msp3410 daemon started\n");
 
        for (;;) {
-               v4l_dbg(2, client, "msp3410 thread: sleep\n");
+               v4l_dbg(2, msp_debug, client, "msp3410 thread: sleep\n");
                msp_sleep(state,-1);
-               v4l_dbg(2, client, "msp3410 thread: wakeup\n");
+               v4l_dbg(2, msp_debug, client, "msp3410 thread: wakeup\n");
 
        restart:
-               v4l_dbg(1, client, "thread: restart scan\n");
+               v4l_dbg(1, msp_debug, client, "thread: restart scan\n");
                state->restart = 0;
                if (kthread_should_stop())
                        break;
 
                if (state->mode == MSP_MODE_EXTERN) {
                        /* no carrier scan needed, just unmute */
-                       v4l_dbg(1, client, "thread: no carrier scan\n");
+                       v4l_dbg(1, msp_debug, client, "thread: no carrier scan\n");
                        msp_set_audio(client);
                        continue;
                }
@@ -682,8 +682,8 @@ int msp3410d_thread(void *data)
                        std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1;
                state->watch_stereo = 0;
 
-               if (debug)
-                       v4l_dbg(1, client, "setting standard: %s (0x%04x)\n",
+               if (msp_debug)
+                       v4l_dbg(1, msp_debug, client, "setting standard: %s (0x%04x)\n",
                               msp_standard_std_name(std), std);
 
                if (std != 1) {
@@ -700,22 +700,22 @@ int msp3410d_thread(void *data)
                                val = msp_read_dem(client, 0x7e);
                                if (val < 0x07ff)
                                        break;
-                               v4l_dbg(1, client, "detection still in progress\n");
+                               v4l_dbg(1, msp_debug, client, "detection still in progress\n");
                        }
                }
                for (i = 0; msp_stdlist[i].name != NULL; i++)
                        if (msp_stdlist[i].retval == val)
                                break;
-               v4l_dbg(1, client, "current standard: %s (0x%04x)\n",
+               v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n",
                        msp_standard_std_name(val), val);
                state->main   = msp_stdlist[i].main;
                state->second = msp_stdlist[i].second;
                state->std = val;
 
-               if (amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) &&
+               if (msp_amsound && !state->radio && (state->v4l2_std & V4L2_STD_SECAM) &&
                                (val != 0x0009)) {
                        /* autodetection has failed, let backup */
-                       v4l_dbg(1, client, "autodetection failed,"
+                       v4l_dbg(1, msp_debug, client, "autodetection failed,"
                                " switching to backup standard: %s (0x%04x)\n",
                                msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val);
                        val = 0x0009;
@@ -798,13 +798,13 @@ int msp3410d_thread(void *data)
                        watch_stereo(client);
                }
        }
-       v4l_dbg(1, client, "thread: exit\n");
+       v4l_dbg(1, msp_debug, client, "thread: exit\n");
        return 0;
 }
 
 /* ----------------------------------------------------------------------- */
 
-/* msp34xxG + (autoselect no-thread)                                          */
+/* msp34xxG + (autoselect no-thread)                                       */
 /* this one uses both automatic standard detection and automatic sound     */
 /* select which are available in the newer G versions                      */
 /* struct msp: only norm, acb and source are really used in this mode      */
@@ -825,7 +825,7 @@ static void msp34xxg_set_source(struct i2c_client *client, int source)
         */
        int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20);
 
-       v4l_dbg(1, client, "set source to %d (0x%x)\n", source, value);
+       v4l_dbg(1, msp_debug, client, "set source to %d (0x%x)\n", source, value);
        /* Loudspeaker Output */
        msp_write_dsp(client, 0x08, value);
        /* SCART1 DA Output */
@@ -840,7 +840,7 @@ static void msp34xxg_set_source(struct i2c_client *client, int source)
         * 0x7f0 = forced mono mode
         */
        /* a2 threshold for stereo/bilingual */
-       msp_write_dem(client, 0x22, stereo_threshold);
+       msp_write_dem(client, 0x22, msp_stereo_thresh);
        state->source = source;
 }
 
@@ -897,28 +897,28 @@ int msp34xxg_thread(void *data)
        struct msp_state *state = i2c_get_clientdata(client);
        int val, std, i;
 
-       v4l_dbg(1, client, "msp34xxg daemon started\n");
+       v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n");
 
        state->source = 1; /* default */
        for (;;) {
-               v4l_dbg(2, client, "msp34xxg thread: sleep\n");
+               v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n");
                msp_sleep(state, -1);
-               v4l_dbg(2, client, "msp34xxg thread: wakeup\n");
+               v4l_dbg(2, msp_debug, client, "msp34xxg thread: wakeup\n");
 
        restart:
-               v4l_dbg(1, client, "thread: restart scan\n");
+               v4l_dbg(1, msp_debug, client, "thread: restart scan\n");
                state->restart = 0;
                if (kthread_should_stop())
                        break;
 
                /* setup the chip*/
                msp34xxg_reset(client);
-               std = standard;
+               std = msp_standard;
                if (std != 0x01)
                        goto unmute;
 
                /* watch autodetect */
-               v4l_dbg(1, client, "triggered autodetect, waiting for result\n");
+               v4l_dbg(1, msp_debug, client, "triggered autodetect, waiting for result\n");
                for (i = 0; i < 10; i++) {
                        if (msp_sleep(state, 100))
                                goto restart;
@@ -929,16 +929,16 @@ int msp34xxg_thread(void *data)
                                std = val;
                                break;
                        }
-                       v4l_dbg(2, client, "detection still in progress\n");
+                       v4l_dbg(2, msp_debug, client, "detection still in progress\n");
                }
                if (std == 1) {
-                       v4l_dbg(1, client, "detection still in progress after 10 tries. giving up.\n");
+                       v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n");
                        continue;
                }
 
        unmute:
                state->std = std;
-               v4l_dbg(1, client, "current standard: %s (0x%04x)\n",
+               v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n",
                        msp_standard_std_name(std), std);
 
                /* unmute: dispatch sound to scart output, set scart volume */
@@ -950,7 +950,7 @@ int msp34xxg_thread(void *data)
 
                msp_write_dem(client, 0x40, state->i2s_mode);
        }
-       v4l_dbg(1, client, "thread: exit\n");
+       v4l_dbg(1, msp_debug, client, "thread: exit\n");
        return 0;
 }
 
@@ -976,7 +976,7 @@ void msp34xxg_detect_stereo(struct i2c_client *client)
                 * this is a problem, I'll handle SAP just like lang1/lang2.
                 */
        }
-       v4l_dbg(1, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n",
+       v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n",
                status, is_stereo, is_bilingual, state->rxsubchans);
 }
 
index 8a05cf500a8cf8d882d830fb6cdc0c1556308a1e..70a5ef8ba0179cea8b975c95f257effcc2644820 100644 (file)
@@ -48,12 +48,12 @@ struct msp_matrix {
 #define OPMODE_AUTOSELECT  2   /* use autodetect & autoselect (>= msp34xxG)   */
 
 /* module parameters */
-extern int debug;
-extern int once;
-extern int amsound;
-extern int standard;
-extern int dolby;
-extern int stereo_threshold;
+extern int msp_debug;
+extern int msp_once;
+extern int msp_amsound;
+extern int msp_standard;
+extern int msp_dolby;
+extern int msp_stereo_thresh;
 
 struct msp_state {
        int rev1, rev2;
index 2c19c9588c0287cb1c407b8fb665299b737e83d3..0bf1caac588794db2925afcba6193ad0e31eecc5 100644 (file)
@@ -21,7 +21,7 @@ static unsigned int radio_antenna = 0;
 module_param(radio_antenna,     int, 0644);
 
 /* from tuner-core.c */
-extern int debug;
+extern int tuner_debug;
 
 /* ---------------------------------------------------------------------- */
 
@@ -404,7 +404,7 @@ static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned
        div2a=(lo2/8)-1;
        div2b=lo2-(div2a+1)*8;
 
-       if (debug > 1) {
+       if (tuner_debug > 1) {
                tuner_dbg("lo1 lo2 = %d %d\n", lo1, lo2);
                tuner_dbg("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n",
                          num1,num2,div1a,div1b,div2a,div2b);
@@ -420,7 +420,7 @@ static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned
        buf[5]=div2a;
        if(num2!=0) buf[5]=buf[5]|0x40;
 
-       if (debug > 1) {
+       if (tuner_debug > 1) {
                int i;
                tuner_dbg("bufs is: ");
                for(i=0;i<6;i++)
@@ -508,7 +508,7 @@ int microtune_init(struct i2c_client *c)
 
        i2c_master_send(c,buf,1);
        i2c_master_recv(c,buf,21);
-       if (debug) {
+       if (tuner_debug) {
                int i;
                tuner_dbg("MT20xx hexdump:");
                for(i=0;i<21;i++) {
index 91681aa6c6574261102deb36a60fe47fad63e005..8416ceff524bf3f5900e5b684cf7e439fc19c4ec 100644 (file)
@@ -177,12 +177,11 @@ static int mxb_probe(struct saa7146_dev* dev)
                return -ENODEV;
        }
 
-       mxb = (struct mxb*)kmalloc(sizeof(struct mxb), GFP_KERNEL);
+       mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL);
        if( NULL == mxb ) {
                DEB_D(("not enough kernel memory.\n"));
                return -ENOMEM;
        }
-       memset(mxb, 0x0, sizeof(struct mxb));   
 
        mxb->i2c_adapter = (struct i2c_adapter) {
                .class = I2C_CLASS_TV_ANALOG,
index b3f4d266cedead6f1afd053ec0b4e2edd117b88e..c04130dab127b17a7a86c928a997be6745c86b26 100644 (file)
@@ -178,10 +178,9 @@ static int ov6x20_init(struct i2c_client *c)
        if (rc < 0)
                return rc;
 
-       ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL);
+       ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
        if (!s)
                return -ENOMEM;
-       memset(s, 0, sizeof *s);
 
        s->auto_brt = 1;
        s->auto_exp = 1;
index 6eab458ab792a88e58313731f11ab27160fe1535..73b94f51a85a8c03f4e126fd67db612a82fce754 100644 (file)
@@ -141,10 +141,9 @@ static int ov6x30_init(struct i2c_client *c)
        if (rc < 0)
                return rc;
 
-       ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL);
+       ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
        if (!s)
                return -ENOMEM;
-       memset(s, 0, sizeof *s);
 
        s->auto_brt = 1;
        s->auto_exp = 1;
index 29bbdc05e3b687ede034bff12cb668f5c203a3ff..11f6be924d8b4d4e42cbfe732d1acbec988c20b3 100644 (file)
@@ -105,10 +105,9 @@ static int ov76be_init(struct i2c_client *c)
        if (rc < 0)
                return rc;
 
-       ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL);
+       ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
        if (!s)
                return -ENOMEM;
-       memset(s, 0, sizeof *s);
 
        s->auto_brt = 1;
        s->auto_exp = 1;
index 6c383d4b14fa4f378c64591fddac92446f7dad23..5206e7913924dc83aefc4c472b48dfa7f0ea9a29 100644 (file)
@@ -115,10 +115,9 @@ static int ov7x10_init(struct i2c_client *c)
        if (rc < 0)
                return rc;
 
-       ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL);
+       ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
        if (!s)
                return -ENOMEM;
-       memset(s, 0, sizeof *s);
 
        s->auto_brt = 1;
        s->auto_exp = 1;
index 3c8c48f338bafff423d17b732111e34eb19167f3..8e26ae338f317a28910a02be71c83d3bb1da7655 100644 (file)
@@ -232,10 +232,9 @@ static int ov7x20_init(struct i2c_client *c)
        if (rc < 0)
                return rc;
 
-       ov->spriv = s = kmalloc(sizeof *s, GFP_KERNEL);
+       ov->spriv = s = kzalloc(sizeof *s, GFP_KERNEL);
        if (!s)
                return -ENOMEM;
-       memset(s, 0, sizeof *s);
 
        s->auto_brt = 1;
        s->auto_exp = DFL_AUTO_EXP;
index 428f1bb75ec30620a98cd9074e2277cdada67976..e76b53d5909cf97cbca24634f2df1e5adc4cfb74 100644 (file)
@@ -316,12 +316,11 @@ static int ovcamchip_attach(struct i2c_adapter *adap)
        c->adapter = adap;
        strcpy(c->name, "OV????");
 
-       ov = kmalloc(sizeof *ov, GFP_KERNEL);
+       ov = kzalloc(sizeof *ov, GFP_KERNEL);
        if (!ov) {
                rc = -ENOMEM;
                goto no_ov;
        }
-       memset(ov, 0, sizeof *ov);
        i2c_set_clientdata(c, ov);
 
        rc = ovcamchip_detect(c);
index 0aa9e72f632c605140c883787dd71af1708ac599..2ce0102013083bdbd497addd96aa55cc3a28ab5b 100644 (file)
@@ -83,13 +83,12 @@ static int saa5246a_attach(struct i2c_adapter *adap, int addr, int kind)
        client_template.adapter = adap;
        client_template.addr = addr;
        memcpy(client, &client_template, sizeof(*client));
-       t = kmalloc(sizeof(*t), GFP_KERNEL);
+       t = kzalloc(sizeof(*t), GFP_KERNEL);
        if(t==NULL)
        {
                kfree(client);
                return -ENOMEM;
        }
-       memset(t, 0, sizeof(*t));
        strlcpy(client->name, IF_NAME, I2C_NAME_SIZE);
        init_MUTEX(&t->lock);
 
index 73b4f0e2abf086d7974e76b6148f2822a8b33ecc..5694eb58c3a1fb5e236e585a0069ea65bb7a34ec 100644 (file)
@@ -151,13 +151,12 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
         client_template.adapter = adap;
         client_template.addr = addr;
        memcpy(client, &client_template, sizeof(*client));
-       t = kmalloc(sizeof(*t), GFP_KERNEL);
+       t = kzalloc(sizeof(*t), GFP_KERNEL);
        if(t==NULL)
        {
                kfree(client);
                return -ENOMEM;
        }
-       memset(t, 0, sizeof(*t));
        strlcpy(client->name, IF_NAME, I2C_NAME_SIZE);
        init_MUTEX(&t->lock);
        
@@ -165,7 +164,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
         *      Now create a video4linux device
         */
         
-       vd = (struct video_device *)kmalloc(sizeof(struct video_device), GFP_KERNEL);
+       vd = kmalloc(sizeof(struct video_device), GFP_KERNEL);
        if(vd==NULL)
        {
                kfree(t);
index 619ff0b7a1ff3b5a97c1118294e6be41f39c8825..7bb85a7b326ef9bd8955e4beae8c944b015c73f0 100644 (file)
@@ -494,21 +494,19 @@ saa7110_detect_client (struct i2c_adapter *adapter,
             I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_saa7110;
        strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client)));
 
-       decoder = kmalloc(sizeof(struct saa7110), GFP_KERNEL);
+       decoder = kzalloc(sizeof(struct saa7110), GFP_KERNEL);
        if (decoder == 0) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(decoder, 0, sizeof(struct saa7110));
        decoder->norm = VIDEO_MODE_PAL;
        decoder->input = 0;
        decoder->enable = 1;
index acaeee592b54d9b587f3fc918ff52f67130e87ca..8c06592b37ff125a0f50fba400a01e64115f7e26 100644 (file)
@@ -511,21 +511,19 @@ saa7111_detect_client (struct i2c_adapter *adapter,
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_saa7111;
        strlcpy(I2C_NAME(client), "saa7111", sizeof(I2C_NAME(client)));
 
-       decoder = kmalloc(sizeof(struct saa7111), GFP_KERNEL);
+       decoder = kzalloc(sizeof(struct saa7111), GFP_KERNEL);
        if (decoder == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(decoder, 0, sizeof(struct saa7111));
        decoder->norm = VIDEO_MODE_NTSC;
        decoder->input = 0;
        decoder->enable = 1;
index b7ac0122f7291e45a736f30c9f8192b9eff2a1c4..fd0a4b4ef014387394523c70ef17b9e033d2b148 100644 (file)
@@ -852,21 +852,19 @@ saa7114_detect_client (struct i2c_adapter *adapter,
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_saa7114;
        strlcpy(I2C_NAME(client), "saa7114", sizeof(I2C_NAME(client)));
 
-       decoder = kmalloc(sizeof(struct saa7114), GFP_KERNEL);
+       decoder = kzalloc(sizeof(struct saa7114), GFP_KERNEL);
        if (decoder == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(decoder, 0, sizeof(struct saa7114));
        decoder->norm = VIDEO_MODE_NTSC;
        decoder->input = -1;
        decoder->enable = 1;
index 4a4bc69fb0e97a7e95218a3fb563d51a68e841c6..048d000941c78439bbfb3f1f3456524c106398cb 100644 (file)
@@ -549,7 +549,7 @@ static int saa7115_set_audio_clock_freq(struct i2c_client *client, u32 freq)
        u32 hz;
        u64 f;
 
-       v4l_dbg(1, client, "set audio clock freq: %d\n", freq);
+       v4l_dbg(1, debug, client, "set audio clock freq: %d\n", freq);
 
        /* sanity check */
        if (freq < 32000 || freq > 48000)
@@ -670,10 +670,10 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
 
        // This works for NTSC-M, SECAM-L and the 50Hz PAL variants.
        if (std & V4L2_STD_525_60) {
-               v4l_dbg(1, client, "decoder set standard 60 Hz\n");
+               v4l_dbg(1, debug, client, "decoder set standard 60 Hz\n");
                saa7115_writeregs(client, saa7115_cfg_60hz_video);
        } else {
-               v4l_dbg(1, client, "decoder set standard 50 Hz\n");
+               v4l_dbg(1, debug, client, "decoder set standard 50 Hz\n");
                saa7115_writeregs(client, saa7115_cfg_50hz_video);
        }
 
@@ -863,7 +863,7 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
 
        pix = &(fmt->fmt.pix);
 
-       v4l_dbg(1, client, "decoder set size\n");
+       v4l_dbg(1, debug, client, "decoder set size\n");
 
        /* FIXME need better bounds checking here */
        if ((pix->width < 1) || (pix->width > 1440))
@@ -889,7 +889,7 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
                HPSC = HPSC ? HPSC : 1;
                HFSC = (int)((1024 * 720) / (HPSC * pix->width));
 
-               v4l_dbg(1, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC);
+               v4l_dbg(1, debug, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC);
                /* FIXME hardcodes to "Task B"
                 * write H prescaler integer */
                saa7115_write(client, 0xd0, (u8) (HPSC & 0x3f));
@@ -903,10 +903,10 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
                saa7115_write(client, 0xDD, (u8) ((HFSC >> 9) & 0xff));
        } else {
                if (is_50hz) {
-                       v4l_dbg(1, client, "Setting full 50hz width\n");
+                       v4l_dbg(1, debug, client, "Setting full 50hz width\n");
                        saa7115_writeregs(client, saa7115_cfg_50hz_fullres_x);
                } else {
-                       v4l_dbg(1, client, "Setting full 60hz width\n");
+                       v4l_dbg(1, debug, client, "Setting full 60hz width\n");
                        saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x);
                }
        }
@@ -915,7 +915,7 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
 
        if (pix->height != Vsrc) {
                VSCY = (int)((1024 * Vsrc) / pix->height);
-               v4l_dbg(1, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY);
+               v4l_dbg(1, debug, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY);
 
                /* Correct Contrast and Luminance */
                saa7115_write(client, 0xd5, (u8) (64 * 1024 / VSCY));
@@ -929,10 +929,10 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
                saa7115_write(client, 0xe3, (u8) ((VSCY >> 8) & 0xff));
        } else {
                if (is_50hz) {
-                       v4l_dbg(1, client, "Setting full 50Hz height\n");
+                       v4l_dbg(1, debug, client, "Setting full 50Hz height\n");
                        saa7115_writeregs(client, saa7115_cfg_50hz_fullres_y);
                } else {
-                       v4l_dbg(1, client, "Setting full 60hz height\n");
+                       v4l_dbg(1, debug, client, "Setting full 60hz height\n");
                        saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y);
                }
        }
@@ -1079,7 +1079,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
                        break;
                status = saa7115_read(client, 0x1f);
 
-               v4l_dbg(1, client, "status: 0x%02x\n", status);
+               v4l_dbg(1, debug, client, "status: 0x%02x\n", status);
                vt->signal = ((status & (1 << 6)) == 0) ? 0xffff : 0x0;
                break;
        }
@@ -1125,7 +1125,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
                break;
 
        case VIDIOC_S_INPUT:
-               v4l_dbg(1, client, "decoder set input %d\n", *iarg);
+               v4l_dbg(1, debug, client, "decoder set input %d\n", *iarg);
                /* inputs from 0-9 are available */
                if (*iarg < 0 || *iarg > 9) {
                        return -EINVAL;
@@ -1133,7 +1133,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
 
                if (state->input == *iarg)
                        break;
-               v4l_dbg(1, client, "now setting %s input\n",
+               v4l_dbg(1, debug, client, "now setting %s input\n",
                        *iarg >= 6 ? "S-Video" : "Composite");
                state->input = *iarg;
 
@@ -1150,7 +1150,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
 
        case VIDIOC_STREAMON:
        case VIDIOC_STREAMOFF:
-               v4l_dbg(1, client, "%s output\n",
+               v4l_dbg(1, debug, client, "%s output\n",
                        (cmd == VIDIOC_STREAMON) ? "enable" : "disable");
 
                if (state->enable != (cmd == VIDIOC_STREAMON)) {
@@ -1164,7 +1164,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
                break;
 
        case VIDIOC_INT_RESET:
-               v4l_dbg(1, client, "decoder RESET\n");
+               v4l_dbg(1, debug, client, "decoder RESET\n");
                saa7115_writeregs(client, saa7115_cfg_reset_scaler);
                break;
 
@@ -1249,21 +1249,20 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_saa7115;
        snprintf(client->name, sizeof(client->name) - 1, "saa7115");
 
-       v4l_dbg(1, client, "detecting saa7115 client on address 0x%x\n", address << 1);
+       v4l_dbg(1, debug, client, "detecting saa7115 client on address 0x%x\n", address << 1);
 
        saa7115_write(client, 0, 5);
        chip_id = saa7115_read(client, 0) & 0x0f;
        if (chip_id != 4 && chip_id != 5) {
-               v4l_dbg(1, client, "saa7115 not found\n");
+               v4l_dbg(1, debug, client, "saa7115 not found\n");
                kfree(client);
                return 0;
        }
@@ -1272,13 +1271,12 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
        }
        v4l_info(client, "saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name);
 
-       state = kmalloc(sizeof(struct saa7115_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct saa7115_state), GFP_KERNEL);
        i2c_set_clientdata(client, state);
        if (state == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(state, 0, sizeof(struct saa7115_state));
        state->std = V4L2_STD_NTSC;
        state->input = -1;
        state->enable = 1;
@@ -1290,7 +1288,7 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
        state->ident = (chip_id == 4) ? V4L2_IDENT_SAA7114 : V4L2_IDENT_SAA7115;
        state->audclk_freq = 48000;
 
-       v4l_dbg(1, client, "writing init values\n");
+       v4l_dbg(1, debug, client, "writing init values\n");
 
        /* init to 60hz/48khz */
        saa7115_writeregs(client, saa7115_init_auto_input);
@@ -1303,7 +1301,7 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
 
        i2c_attach_client(client);
 
-       v4l_dbg(1, client, "status: (1E) 0x%02x, (1F) 0x%02x\n",
+       v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n",
                saa7115_read(client, 0x1e), saa7115_read(client, 0x1f));
 
        return 0;
index f39a7be08588010fe5c29393793f2e576c5cbf1c..ae53063875f922dd0d4a9a783ba67ca22a3e85cb 100644 (file)
@@ -487,20 +487,18 @@ saa711x_detect_client (struct i2c_adapter *adapter,
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_saa711x;
        strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client)));
-       decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL);
+       decoder = kzalloc(sizeof(struct saa711x), GFP_KERNEL);
        if (decoder == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(decoder, 0, sizeof(struct saa711x));
        decoder->norm = VIDEO_MODE_NTSC;
        decoder->input = 0;
        decoder->enable = 1;
index 2009c1bc47207c1b1f4e8d8eb75d5e6027399e22..992c71774f303f40fea02013481c16ef2f30edfe 100644 (file)
@@ -338,7 +338,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat
        if (enable && (data->field != 0 || data->line != 16))
                return -EINVAL;
        if (state->vps_enable != enable) {
-               v4l_dbg(1, client, "Turn VPS Signal %s\n", enable ? "on" : "off");
+               v4l_dbg(1, debug, client, "Turn VPS Signal %s\n", enable ? "on" : "off");
                saa7127_write(client, 0x54, enable << 7);
                state->vps_enable = enable;
        }
@@ -350,7 +350,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat
        state->vps_data[2] = data->data[11];
        state->vps_data[3] = data->data[12];
        state->vps_data[4] = data->data[13];
-       v4l_dbg(1, client, "Set VPS data %02x %02x %02x %02x %02x\n",
+       v4l_dbg(1, debug, client, "Set VPS data %02x %02x %02x %02x %02x\n",
                state->vps_data[0], state->vps_data[1],
                state->vps_data[2], state->vps_data[3],
                state->vps_data[4]);
@@ -373,7 +373,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
        if (enable && (data->field != 0 || data->line != 21))
                return -EINVAL;
        if (state->cc_enable != enable) {
-               v4l_dbg(1, client, "Turn CC %s\n", enable ? "on" : "off");
+               v4l_dbg(1, debug, client, "Turn CC %s\n", enable ? "on" : "off");
                saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
                                (state->xds_enable << 7) | (enable << 6) | 0x11);
                state->cc_enable = enable;
@@ -381,7 +381,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
        if (!enable)
                return 0;
 
-       v4l_dbg(2, client, "CC data: %04x\n", cc);
+       v4l_dbg(2, debug, client, "CC data: %04x\n", cc);
        saa7127_write(client, SAA7127_REG_LINE_21_ODD_0, cc & 0xff);
        saa7127_write(client, SAA7127_REG_LINE_21_ODD_1, cc >> 8);
        state->cc_data = cc;
@@ -399,7 +399,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat
        if (enable && (data->field != 1 || data->line != 21))
                return -EINVAL;
        if (state->xds_enable != enable) {
-               v4l_dbg(1, client, "Turn XDS %s\n", enable ? "on" : "off");
+               v4l_dbg(1, debug, client, "Turn XDS %s\n", enable ? "on" : "off");
                saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
                                (enable << 7) | (state->cc_enable << 6) | 0x11);
                state->xds_enable = enable;
@@ -407,7 +407,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat
        if (!enable)
                return 0;
 
-       v4l_dbg(2, client, "XDS data: %04x\n", xds);
+       v4l_dbg(2, debug, client, "XDS data: %04x\n", xds);
        saa7127_write(client, SAA7127_REG_LINE_21_EVEN_0, xds & 0xff);
        saa7127_write(client, SAA7127_REG_LINE_21_EVEN_1, xds >> 8);
        state->xds_data = xds;
@@ -424,7 +424,7 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat
        if (enable && (data->field != 0 || data->line != 23))
                return -EINVAL;
        if (state->wss_enable != enable) {
-               v4l_dbg(1, client, "Turn WSS %s\n", enable ? "on" : "off");
+               v4l_dbg(1, debug, client, "Turn WSS %s\n", enable ? "on" : "off");
                saa7127_write(client, 0x27, enable << 7);
                state->wss_enable = enable;
        }
@@ -433,7 +433,7 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat
 
        saa7127_write(client, 0x26, data->data[0]);
        saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f));
-       v4l_dbg(1, client, "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]);
+       v4l_dbg(1, debug, client, "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]);
        state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0];
        return 0;
 }
@@ -445,11 +445,11 @@ static int saa7127_set_video_enable(struct i2c_client *client, int enable)
        struct saa7127_state *state = i2c_get_clientdata(client);
 
        if (enable) {
-               v4l_dbg(1, client, "Enable Video Output\n");
+               v4l_dbg(1, debug, client, "Enable Video Output\n");
                saa7127_write(client, 0x2d, state->reg_2d);
                saa7127_write(client, 0x61, state->reg_61);
        } else {
-               v4l_dbg(1, client, "Disable Video Output\n");
+               v4l_dbg(1, debug, client, "Disable Video Output\n");
                saa7127_write(client, 0x2d, (state->reg_2d & 0xf0));
                saa7127_write(client, 0x61, (state->reg_61 | 0xc0));
        }
@@ -465,11 +465,11 @@ static int saa7127_set_std(struct i2c_client *client, v4l2_std_id std)
        const struct i2c_reg_value *inittab;
 
        if (std & V4L2_STD_525_60) {
-               v4l_dbg(1, client, "Selecting 60 Hz video Standard\n");
+               v4l_dbg(1, debug, client, "Selecting 60 Hz video Standard\n");
                inittab = saa7127_init_config_60hz;
                state->reg_61 = SAA7127_60HZ_DAC_CONTROL;
        } else {
-               v4l_dbg(1, client, "Selecting 50 Hz video Standard\n");
+               v4l_dbg(1, debug, client, "Selecting 50 Hz video Standard\n");
                inittab = saa7127_init_config_50hz;
                state->reg_61 = SAA7127_50HZ_DAC_CONTROL;
        }
@@ -520,7 +520,7 @@ static int saa7127_set_output_type(struct i2c_client *client, int output)
        default:
                return -EINVAL;
        }
-       v4l_dbg(1, client, "Selecting %s output type\n", output_strs[output]);
+       v4l_dbg(1, debug, client, "Selecting %s output type\n", output_strs[output]);
 
        /* Configure Encoder */
        saa7127_write(client, 0x2d, state->reg_2d);
@@ -537,12 +537,12 @@ static int saa7127_set_input_type(struct i2c_client *client, int input)
 
        switch (input) {
        case SAA7127_INPUT_TYPE_NORMAL: /* avia */
-               v4l_dbg(1, client, "Selecting Normal Encoder Input\n");
+               v4l_dbg(1, debug, client, "Selecting Normal Encoder Input\n");
                state->reg_3a_cb = 0;
                break;
 
        case SAA7127_INPUT_TYPE_TEST_IMAGE:     /* color bar */
-               v4l_dbg(1, client, "Selecting Color Bar generator\n");
+               v4l_dbg(1, debug, client, "Selecting Color Bar generator\n");
                state->reg_3a_cb = 0x80;
                break;
 
@@ -689,17 +689,16 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
 
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_saa7127;
        snprintf(client->name, sizeof(client->name) - 1, "saa7127");
 
-       v4l_dbg(1, client, "detecting saa7127 client on address 0x%x\n", address << 1);
+       v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n", address << 1);
 
        /* First test register 0: Bits 5-7 are a version ID (should be 0),
           and bit 2 should also be 0.
@@ -708,11 +707,11 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
           0x1d after a reset and not expected to ever change. */
        if ((saa7127_read(client, 0) & 0xe4) != 0 ||
                        (saa7127_read(client, 0x29) & 0x3f) != 0x1d) {
-               v4l_dbg(1, client, "saa7127 not found\n");
+               v4l_dbg(1, debug, client, "saa7127 not found\n");
                kfree(client);
                return 0;
        }
-       state = kmalloc(sizeof(struct saa7127_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct saa7127_state), GFP_KERNEL);
 
        if (state == NULL) {
                kfree(client);
@@ -720,11 +719,10 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
        }
 
        i2c_set_clientdata(client, state);
-       memset(state, 0, sizeof(struct saa7127_state));
 
        /* Configure Encoder */
 
-       v4l_dbg(1, client, "Configuring encoder\n");
+       v4l_dbg(1, debug, client, "Configuring encoder\n");
        saa7127_write_inittab(client, saa7127_init_config_common);
        saa7127_set_std(client, V4L2_STD_NTSC);
        saa7127_set_output_type(client, SAA7127_OUTPUT_TYPE_BOTH);
index 8a5c3e71b37d193be112f9da6f65f6c38d0c98ff..86671a43e769850e2e8ed971a89158fffe65d53b 100644 (file)
@@ -15,7 +15,7 @@ config VIDEO_SAA7134
 config VIDEO_SAA7134_ALSA
        tristate "Philips SAA7134 DMA audio support"
        depends on VIDEO_SAA7134 && SND
-       select SND_PCM_OSS
+       select SND_PCM
        ---help---
          This is a video4linux driver for direct (DMA) audio in
          Philips SAA713x based TV cards using ALSA
index ad73c4a60f2b2078f788d2d45aed9502bd065441..0e0ba50946e8923e9dc230cad0d046cc46cebe5f 100644 (file)
@@ -511,9 +511,8 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind)
        struct saa6752hs_state *h;
 
 
-       if (NULL == (h = kmalloc(sizeof(*h), GFP_KERNEL)))
+       if (NULL == (h = kzalloc(sizeof(*h), GFP_KERNEL)))
                return -ENOMEM;
-       memset(h,0,sizeof(*h));
        h->client = client_template;
        h->params = param_defaults;
        h->client.adapter = adap;
index 77e5be98e4c67887d3b33c4fcf2d33e0d28a0d68..275d06af69d2cc649bf7a0c80fe07149de315037 100644 (file)
@@ -1666,7 +1666,7 @@ struct saa7134_board saa7134_boards[] = {
                .radio_type     = UNSET,
                .tuner_addr     = ADDR_UNSET,
                .radio_addr     = ADDR_UNSET,
-               .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,
+               .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER | TDA9887_PORT2_ACTIVE,
                .mpeg           = SAA7134_MPEG_DVB,
                .inputs         = {{
                        .name = name_tv,
index accbc32725cf9d9fdd190c0ff5590e83d8d97291..3983a6524cac98107a02b126babd1117c0cfb853 100644 (file)
@@ -803,10 +803,9 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        struct saa7134_mpeg_ops *mops;
        int err;
 
-       dev = kmalloc(sizeof(*dev),GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev),GFP_KERNEL);
        if (NULL == dev)
                return -ENOMEM;
-       memset(dev,0,sizeof(*dev));
 
        /* pci init */
        dev->pci = pci_dev;
index adfa8fe49a11547c468e5a418f88e841d106deb4..e97426bc85df6aece8d49fd7aa639a0a36b7b5f8 100644 (file)
@@ -1264,10 +1264,9 @@ static int video_open(struct inode *inode, struct file *file)
                v4l2_type_names[type]);
 
        /* allocate + initialize per filehandle data */
-       fh = kmalloc(sizeof(*fh),GFP_KERNEL);
+       fh = kzalloc(sizeof(*fh),GFP_KERNEL);
        if (NULL == fh)
                return -ENOMEM;
-       memset(fh,0,sizeof(*fh));
        file->private_data = fh;
        fh->dev      = dev;
        fh->radio    = radio;
index f305ec802ea6ce1250369185dc4932b7cb766440..756963f01bbdcb7de9042793264f93cca88d719f 100644 (file)
@@ -73,7 +73,6 @@ struct saa7146
         unsigned int nr;
        unsigned long irq;          /* IRQ used by SAA7146 card */
        unsigned short id;
-       struct pci_dev *dev;
        unsigned char revision;
        unsigned char boardcfg[64];     /* 64 bytes of config from eeprom */
        unsigned long saa7146_adr;   /* bus address of IO mem from PCI BIOS */
index f72a9f7962094ed563b09eed09193db602242b6a..3ed0edb870a4eccd295f24eaaacf576cee00e4f9 100644 (file)
@@ -408,21 +408,19 @@ saa7185_detect_client (struct i2c_adapter *adapter,
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_saa7185;
        strlcpy(I2C_NAME(client), "saa7185", sizeof(I2C_NAME(client)));
 
-       encoder = kmalloc(sizeof(struct saa7185), GFP_KERNEL);
+       encoder = kzalloc(sizeof(struct saa7185), GFP_KERNEL);
        if (encoder == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(encoder, 0, sizeof(struct saa7185));
        encoder->norm = VIDEO_MODE_NTSC;
        encoder->enable = 1;
        i2c_set_clientdata(client, encoder);
index 41f6f05a0436b947b7402ed0eeb007dd64b4fb1a..746cadb8f1c45d9b1af42ad892b98cc4a695df4b 100644 (file)
@@ -571,18 +571,15 @@ static int saa7191_attach(struct i2c_adapter *adap, int addr, int kind)
        printk(KERN_INFO "Philips SAA7191 driver version %s\n",
               SAA7191_MODULE_VERSION);
 
-       client = kmalloc(sizeof(*client), GFP_KERNEL);
+       client = kzalloc(sizeof(*client), GFP_KERNEL);
        if (!client)
                return -ENOMEM;
-       decoder = kmalloc(sizeof(*decoder), GFP_KERNEL);
+       decoder = kzalloc(sizeof(*decoder), GFP_KERNEL);
        if (!decoder) {
                err = -ENOMEM;
                goto out_free_client;
        }
 
-       memset(client, 0, sizeof(struct i2c_client));
-       memset(decoder, 0, sizeof(struct saa7191));
-
        client->addr = addr;
        client->adapter = adap;
        client->driver = &i2c_driver_saa7191;
index 6ee54a45411f19ae95b1cf9f3cebe6b8b8b0f82d..54fc33011ffb4b1b1b03cea41bea8b04eaa77c46 100644 (file)
@@ -49,9 +49,9 @@
 #include "saa7121.h"
 #include "cs8420.h"
 
-#define DEBUG(x)               /* debug driver */
-#undef  IDEBUG                 /* debug irq handler */
-#undef  MDEBUG                 /* debug memory management */
+#define DEBUG(x)               /* debug driver */
+#undef  IDEBUG                 /* debug irq handler */
+#undef  MDEBUG                 /* debug memory management */
 
 #define SAA7146_MAX 6
 
@@ -63,7 +63,6 @@ static int video_nr = -1;
 module_param(video_nr, int, 0);
 MODULE_LICENSE("GPL");
 
-
 #define nDebNormal     0x00480000
 #define nDebNoInc      0x00480000
 #define nDebVideo      0xd0480000
@@ -99,7 +98,12 @@ MODULE_LICENSE("GPL");
 
 #ifdef USE_RESCUE_EEPROM_SDM275
 static unsigned char rescue_eeprom[64] = {
-0x00,0x01,0x04,0x13,0x26,0x0f,0x10,0x00,0x00,0x00,0x43,0x63,0x22,0x01,0x29,0x15,0x73,0x00,0x1f, 'd', 'e', 'c', 'x', 'l', 'd', 'v', 'a',0x02,0x00,0x01,0x00,0xcc,0xa4,0x63,0x09,0xe2,0x10,0x00,0x0a,0x00,0x02,0x02, 'd', 'e', 'c', 'x', 'l', 'a',0x00,0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+       0x00, 0x01, 0x04, 0x13, 0x26, 0x0f, 0x10, 0x00, 0x00, 0x00, 0x43, 0x63,
+       0x22, 0x01, 0x29, 0x15, 0x73, 0x00, 0x1f,  'd',  'e',  'c',  'x',  'l',
+        'd',  'v',  'a', 0x02, 0x00, 0x01, 0x00, 0xcc, 0xa4, 0x63, 0x09, 0xe2,
+       0x10, 0x00, 0x0a, 0x00, 0x02, 0x02,  'd',  'e',  'c',  'x',  'l',  'a',
+       0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
 };
 #endif
 
@@ -140,17 +144,18 @@ static int I2CRead(struct saa7146 *saa, unsigned char addr,
 
        if (saaread(SAA7146_I2C_STATUS) & 0x3c)
                I2CWipe(saa);
-       for (i = 0; i < 1000 &&
-            (saaread(SAA7146_I2C_STATUS) & SAA7146_I2C_BUSY); i++)
+       for (i = 0;
+               i < 1000 && (saaread(SAA7146_I2C_STATUS) & SAA7146_I2C_BUSY);
+               i++)
                schedule();
        if (i == 1000)
                I2CWipe(saa);
        if (dosub)
                saawrite(((addr & 0xfe) << 24) | (((addr | 1) & 0xff) << 8) |
-                 ((subaddr & 0xff) << 16) | 0xed, SAA7146_I2C_TRANSFER);
+                       ((subaddr & 0xff) << 16) | 0xed, SAA7146_I2C_TRANSFER);
        else
                saawrite(((addr & 0xfe) << 24) | (((addr | 1) & 0xff) << 16) |
-                        0xf1, SAA7146_I2C_TRANSFER);
+                       0xf1, SAA7146_I2C_TRANSFER);
        saawrite((SAA7146_MC2_UPLD_I2C << 16) |
                 SAA7146_MC2_UPLD_I2C, SAA7146_MC2);
        /* wait for i2c registers to be programmed */
@@ -163,7 +168,7 @@ static int I2CRead(struct saa7146 *saa, unsigned char addr,
                schedule();
        if (saaread(SAA7146_I2C_STATUS) & SAA7146_I2C_ERR)
                return -1;
-       if (i == 1000) 
+       if (i == 1000)
                printk("i2c setup read timeout\n");
        saawrite(0x41, SAA7146_I2C_TRANSFER);
        saawrite((SAA7146_MC2_UPLD_I2C << 16) |
@@ -178,7 +183,7 @@ static int I2CRead(struct saa7146 *saa, unsigned char addr,
                schedule();
        if (saaread(SAA7146_I2C_TRANSFER) & SAA7146_I2C_ERR)
                return -1;
-       if (i == 1000) 
+       if (i == 1000)
                printk("i2c read timeout\n");
        return ((saaread(SAA7146_I2C_TRANSFER) >> 24) & 0xff);
 }
@@ -213,20 +218,22 @@ static void attach_inform(struct saa7146 *saa, int id)
 {
        int i;
 
-       DEBUG(printk(KERN_DEBUG "stradis%d: i2c: device found=%02x\n", saa->nr, id));
-       if (id == 0xa0) { /* we have rev2 or later board, fill in info */
+       DEBUG(printk(KERN_DEBUG "stradis%d: i2c: device found=%02x\n", saa->nr,
+               id));
+       if (id == 0xa0) {       /* we have rev2 or later board, fill in info */
                for (i = 0; i < 64; i++)
                        saa->boardcfg[i] = I2CRead(saa, 0xa0, i, 1);
 #ifdef USE_RESCUE_EEPROM_SDM275
                if (saa->boardcfg[0] != 0) {
-                       printk("stradis%d: WARNING: EEPROM STORED VALUES HAVE BEEN IGNORED\n", saa->nr);
+                       printk("stradis%d: WARNING: EEPROM STORED VALUES HAVE "
+                               "BEEN IGNORED\n", saa->nr);
                        for (i = 0; i < 64; i++)
                                saa->boardcfg[i] = rescue_eeprom[i];
                }
 #endif
                printk("stradis%d: config =", saa->nr);
                for (i = 0; i < 51; i++) {
-                       printk(" %02x",saa->boardcfg[i]);
+                       printk(" %02x", saa->boardcfg[i]);
                }
                printk("\n");
        }
@@ -254,17 +261,19 @@ static int wait_for_debi_done(struct saa7146 *saa)
        for (i = 0; i < 500000 &&
             (saaread(SAA7146_PSR) & SAA7146_PSR_DEBI_S); i++)
                saaread(SAA7146_MC2);
+
        if (i > debiwait_maxwait)
                printk("wait-for-debi-done maxwait: %d\n",
                        debiwait_maxwait = i);
-       
+
        if (i == 500000)
                return -1;
+
        return 0;
 }
 
 static int debiwrite(struct saa7146 *saa, u32 config, int addr,
-                     u32 val, int count)
+       u32 val, int count)
 {
        u32 cmd;
        if (count <= 0 || count > 32764)
@@ -309,41 +318,6 @@ static u32 debiread(struct saa7146 *saa, u32 config, int addr, int count)
        return result;
 }
 
-#if 0 /* unused */
-/* MUST be a multiple of 8 bytes and 8-byte aligned and < 32768 bytes */
-/* data copied into saa->dmadebi buffer, caller must re-enable interrupts */
-static void ibm_block_dram_read(struct saa7146 *saa, int address, int bytes)
-{
-       int i, j;
-       u32 *buf;
-       buf = (u32 *) saa->dmadebi;
-       if (bytes > 0x7000)
-               bytes = 0x7000;
-       saawrite(0, SAA7146_IER);       /* disable interrupts */
-       for (i=0; i < 10000 &&
-               (debiread(saa, debNormal, IBM_MP2_DRAM_CMD_STAT, 2)
-               & 0x8000); i++)
-               saaread(SAA7146_MC2);
-       if (i == 10000)
-               printk(KERN_ERR "stradis%d: dram_busy never cleared\n",
-                       saa->nr);
-       debiwrite(saa, debNormal, IBM_MP2_SRC_ADDR, (address<<16) |
-               (address>>16), 4);
-       debiwrite(saa, debNormal, IBM_MP2_BLOCK_SIZE, bytes, 2);
-       debiwrite(saa, debNormal, IBM_MP2_CMD_STAT, 0x8a10, 2);
-       for (j = 0; j < bytes/4; j++) {
-               for (i = 0; i < 10000 &&
-                       (!(debiread(saa, debNormal, IBM_MP2_DRAM_CMD_STAT, 2)
-                       & 0x4000)); i++)
-                       saaread(SAA7146_MC2);
-               if (i == 10000)
-                       printk(KERN_ERR "stradis%d: dram_ready never set\n",
-                               saa->nr);
-               buf[j] = debiread(saa, debNormal, IBM_MP2_DRAM_DATA, 4);
-       }
-}
-#endif /* unused */
-
 static void do_irq_send_data(struct saa7146 *saa)
 {
        int split, audbytes, vidbytes;
@@ -365,16 +339,15 @@ static void do_irq_send_data(struct saa7146 *saa)
                return;
        }
        /* if at least 1 block audio waiting and audio fifo isn't full */
-       if (audbytes >= 2048 && (debiread(saa, debNormal,
-               IBM_MP2_AUD_FIFO, 2) & 0xff) < 60) {
+       if (audbytes >= 2048 && (debiread(saa, debNormal, IBM_MP2_AUD_FIFO, 2)
+                       & 0xff) < 60) {
                if (saa->audhead > saa->audtail)
                        split = 65536 - saa->audhead;
                else
                        split = 0;
                audbytes = 2048;
                if (split > 0 && split < 2048) {
-                       memcpy(saa->dmadebi, saa->audbuf + saa->audhead,
-                               split);
+                       memcpy(saa->dmadebi, saa->audbuf + saa->audhead, split);
                        saa->audhead = 0;
                        audbytes -= split;
                } else
@@ -383,20 +356,19 @@ static void do_irq_send_data(struct saa7146 *saa)
                        audbytes);
                saa->audhead += audbytes;
                saa->audhead &= 0xffff;
-               debiwrite(saa, debAudio, (NewCard? IBM_MP2_AUD_FIFO :
-                         IBM_MP2_AUD_FIFOW), 0, 2048);
+               debiwrite(saa, debAudio, (NewCard ? IBM_MP2_AUD_FIFO :
+                       IBM_MP2_AUD_FIFOW), 0, 2048);
                wake_up_interruptible(&saa->audq);
-       /* if at least 1 block video waiting and video fifo isn't full */
+               /* if at least 1 block video waiting and video fifo isn't full */
        } else if (vidbytes >= 30720 && (debiread(saa, debNormal,
-               IBM_MP2_FIFO, 2)) < 16384) {
+                                                 IBM_MP2_FIFO, 2)) < 16384) {
                if (saa->vidhead > saa->vidtail)
                        split = 524288 - saa->vidhead;
                else
                        split = 0;
                vidbytes = 30720;
                if (split > 0 && split < 30720) {
-                       memcpy(saa->dmadebi, saa->vidbuf + saa->vidhead,
-                               split);
+                       memcpy(saa->dmadebi, saa->vidbuf + saa->vidhead, split);
                        saa->vidhead = 0;
                        vidbytes -= split;
                } else
@@ -406,7 +378,7 @@ static void do_irq_send_data(struct saa7146 *saa)
                saa->vidhead += vidbytes;
                saa->vidhead &= 0x7ffff;
                debiwrite(saa, debVideo, (NewCard ? IBM_MP2_FIFO :
-                         IBM_MP2_FIFOW), 0, 30720);
+                                         IBM_MP2_FIFOW), 0, 30720);
                wake_up_interruptible(&saa->vidq);
        }
        saawrite(SAA7146_PSR_DEBI_S | SAA7146_PSR_PIN1, SAA7146_IER);
@@ -418,10 +390,10 @@ static void send_osd_data(struct saa7146 *saa)
        if (size > 30720)
                size = 30720;
        /* ensure some multiple of 8 bytes is transferred */
-       size = 8 * ((size + 8)>>3);
+       size = 8 * ((size + 8) >> 3);
        if (size) {
                debiwrite(saa, debNormal, IBM_MP2_OSD_ADDR,
-                         (saa->osdhead>>3), 2);
+                         (saa->osdhead >> 3), 2);
                memcpy(saa->dmadebi, &saa->osdbuf[saa->osdhead], size);
                saa->osdhead += size;
                /* block transfer of next 8 bytes to ~32k bytes */
@@ -435,7 +407,7 @@ static void send_osd_data(struct saa7146 *saa)
 
 static irqreturn_t saa7146_irq(int irq, void *dev_id, struct pt_regs *regs)
 {
-       struct saa7146 *saa = (struct saa7146 *) dev_id;
+       struct saa7146 *saa = dev_id;
        u32 stat, astat;
        int count;
        int handled = 0;
@@ -484,7 +456,7 @@ static irqreturn_t saa7146_irq(int irq, void *dev_id, struct pt_regs *regs)
                                saa->vidinfo.v_size = 480;
 #if 0
                                if (saa->endmarkhead != saa->endmarktail) {
-                                       saa->audhead = 
+                                       saa->audhead =
                                                saa->endmark[saa->endmarkhead];
                                        saa->endmarkhead++;
                                        if (saa->endmarkhead >= MAX_MARKS)
@@ -494,7 +466,7 @@ static irqreturn_t saa7146_irq(int irq, void *dev_id, struct pt_regs *regs)
                        }
                        if (istat & 0x4000) {   /* Sequence Error Code */
                                if (saa->endmarkhead != saa->endmarktail) {
-                                       saa->audhead = 
+                                       saa->audhead =
                                                saa->endmark[saa->endmarkhead];
                                        saa->endmarkhead++;
                                        if (saa->endmarkhead >= MAX_MARKS)
@@ -613,7 +585,7 @@ static int ibm_send_command(struct saa7146 *saa,
        int i;
 
        if (chain)
-               debiwrite(saa, debNormal, IBM_MP2_COMMAND, (command << 1) | 1, 2);
+               debiwrite(saa, debNormal, IBM_MP2_COMMAND, (command << 1)| 1,2);
        else
                debiwrite(saa, debNormal, IBM_MP2_COMMAND, command << 1, 2);
        debiwrite(saa, debNormal, IBM_MP2_CMD_DATA, data, 2);
@@ -663,11 +635,9 @@ static void initialize_cs8420(struct saa7146 *saa, int pro)
        else
                sequence = mode8420con;
        for (i = 0; i < INIT8420LEN; i++)
-               I2CWrite(saa, 0x20, init8420[i * 2],
-                        init8420[i * 2 + 1], 2);
+               I2CWrite(saa, 0x20, init8420[i * 2], init8420[i * 2 + 1], 2);
        for (i = 0; i < MODE8420LEN; i++)
-               I2CWrite(saa, 0x20, sequence[i * 2],
-                        sequence[i * 2 + 1], 2);
+               I2CWrite(saa, 0x20, sequence[i * 2], sequence[i * 2 + 1], 2);
        printk("stradis%d: CS8420 initialized\n", saa->nr);
 }
 
@@ -683,35 +653,36 @@ static void initialize_saa7121(struct saa7146 *saa, int dopal)
        /* initialize PAL/NTSC video encoder */
        for (i = 0; i < INIT7121LEN; i++) {
                if (NewCard) {  /* handle new card encoder differences */
-                       if (sequence[i*2] == 0x3a)
+                       if (sequence[i * 2] == 0x3a)
                                I2CWrite(saa, 0x88, 0x3a, 0x13, 2);
-                       else if (sequence[i*2] == 0x6b)
+                       else if (sequence[i * 2] == 0x6b)
                                I2CWrite(saa, 0x88, 0x6b, 0x20, 2);
-                       else if (sequence[i*2] == 0x6c)
+                       else if (sequence[i * 2] == 0x6c)
                                I2CWrite(saa, 0x88, 0x6c,
                                         dopal ? 0x09 : 0xf5, 2);
-                       else if (sequence[i*2] == 0x6d)
+                       else if (sequence[i * 2] == 0x6d)
                                I2CWrite(saa, 0x88, 0x6d,
                                         dopal ? 0x20 : 0x00, 2);
-                       else if (sequence[i*2] == 0x7a)
+                       else if (sequence[i * 2] == 0x7a)
                                I2CWrite(saa, 0x88, 0x7a,
                                         dopal ? (PALFirstActive - 1) :
                                         (NTSCFirstActive - 4), 2);
-                       else if (sequence[i*2] == 0x7b)
+                       else if (sequence[i * 2] == 0x7b)
                                I2CWrite(saa, 0x88, 0x7b,
                                         dopal ? PALLastActive :
                                         NTSCLastActive, 2);
-                       else I2CWrite(saa, 0x88, sequence[i * 2],
-                                sequence[i * 2 + 1], 2);
+                       else
+                               I2CWrite(saa, 0x88, sequence[i * 2],
+                                        sequence[i * 2 + 1], 2);
                } else {
-                       if (sequence[i*2] == 0x6b && mod)
-                               I2CWrite(saa, 0x88, 0x6b, 
-                                       (sequence[i * 2 + 1] ^ 0x09), 2);
-                       else if (sequence[i*2] == 0x7a)
+                       if (sequence[i * 2] == 0x6b && mod)
+                               I2CWrite(saa, 0x88, 0x6b,
+                                        (sequence[i * 2 + 1] ^ 0x09), 2);
+                       else if (sequence[i * 2] == 0x7a)
                                I2CWrite(saa, 0x88, 0x7a,
                                         dopal ? (PALFirstActive - 1) :
                                         (NTSCFirstActive - 4), 2);
-                       else if (sequence[i*2] == 0x7b)
+                       else if (sequence[i * 2] == 0x7b)
                                I2CWrite(saa, 0x88, 0x7b,
                                         dopal ? PALLastActive :
                                         NTSCLastActive, 2);
@@ -735,7 +706,8 @@ static void set_genlock_offset(struct saa7146 *saa, int noffset)
        nCode = noffset + 0x100;
        if (nCode == 1)
                nCode = 0x401;
-       else if (nCode < 1) nCode = 0x400 + PixelsPerLine + nCode;
+       else if (nCode < 1)
+               nCode = 0x400 + PixelsPerLine + nCode;
        debiwrite(saa, debNormal, XILINX_GLDELAY, nCode, 2);
 }
 
@@ -745,33 +717,31 @@ static void set_out_format(struct saa7146 *saa, int mode)
        saa->boardcfg[2] = mode;
        /* do not adjust analog video parameters here, use saa7121 init */
        /* you will affect the SDI output on the new card */
-       if (mode == VIDEO_MODE_PAL) {           /* PAL */
+       if (mode == VIDEO_MODE_PAL) {   /* PAL */
                debiwrite(saa, debNormal, XILINX_CTL0, 0x0808, 2);
                mdelay(50);
                saawrite(0x012002c0, SAA7146_NUM_LINE_BYTE1);
                if (NewCard) {
-                       debiwrite(saa, debNormal, IBM_MP2_DISP_MODE,
-                                 0xe100, 2);
+                       debiwrite(saa, debNormal, IBM_MP2_DISP_MODE, 0xe100, 2);
                        mdelay(50);
                }
                debiwrite(saa, debNormal, IBM_MP2_DISP_MODE,
-                         NewCard ? 0xe500: 0x6500, 2);
+                         NewCard ? 0xe500 : 0x6500, 2);
                debiwrite(saa, debNormal, IBM_MP2_DISP_DLY,
                          (1 << 8) |
-                         (NewCard ? PALFirstActive : PALFirstActive-6), 2);
+                         (NewCard ? PALFirstActive : PALFirstActive - 6), 2);
        } else {                /* NTSC */
                debiwrite(saa, debNormal, XILINX_CTL0, 0x0800, 2);
                mdelay(50);
                saawrite(0x00f002c0, SAA7146_NUM_LINE_BYTE1);
                debiwrite(saa, debNormal, IBM_MP2_DISP_MODE,
-                         NewCard ? 0xe100: 0x6100, 2);
+                         NewCard ? 0xe100 : 0x6100, 2);
                debiwrite(saa, debNormal, IBM_MP2_DISP_DLY,
                          (1 << 8) |
-                         (NewCard ? NTSCFirstActive : NTSCFirstActive-6), 2);
+                         (NewCard ? NTSCFirstActive : NTSCFirstActive - 6), 2);
        }
 }
 
-
 /* Intialize bitmangler to map from a byte value to the mangled word that
  * must be output to program the Xilinx part through the DEBI port.
  * Xilinx Data Bit->DEBI Bit: 0->15 1->7 2->6 3->12 4->11 5->2 6->1 7->0
@@ -799,43 +769,41 @@ static int initialize_fpga(struct video_code *bitdata)
        for (num = 0; num < saa_num; num++) {
                saa = &saa7146s[num];
                if (saa->boardcfg[0] > 20)
-                               continue;       /* card was programmed */
+                       continue;       /* card was programmed */
                loadtwo = (saa->boardcfg[18] & 0x10);
                if (!NewCard)   /* we have an old board */
                        for (i = 0; i < 256; i++)
-                           bitmangler[i] = ((i & 0x01) << 15) |
-                               ((i & 0x02) << 6) | ((i & 0x04) << 4) |
-                               ((i & 0x08) << 9) | ((i & 0x10) << 7) |
-                               ((i & 0x20) >> 3) | ((i & 0x40) >> 5) |
-                               ((i & 0x80) >> 7);
-               else    /* else we have a new board */
+                               bitmangler[i] = ((i & 0x01) << 15) |
+                                       ((i & 0x02) << 6) | ((i & 0x04) << 4) |
+                                       ((i & 0x08) << 9) | ((i & 0x10) << 7) |
+                                       ((i & 0x20) >> 3) | ((i & 0x40) >> 5) |
+                                       ((i & 0x80) >> 7);
+               else            /* else we have a new board */
                        for (i = 0; i < 256; i++)
-                           bitmangler[i] = ((i & 0x01) << 7) |
-                               ((i & 0x02) << 5) | ((i & 0x04) << 3) |
-                               ((i & 0x08) << 1) | ((i & 0x10) >> 1) |
-                               ((i & 0x20) >> 3) | ((i & 0x40) >> 5) |
-                               ((i & 0x80) >> 7);
+                               bitmangler[i] = ((i & 0x01) << 7) |
+                                       ((i & 0x02) << 5) | ((i & 0x04) << 3) |
+                                       ((i & 0x08) << 1) | ((i & 0x10) >> 1) |
+                                       ((i & 0x20) >> 3) | ((i & 0x40) >> 5) |
+                                       ((i & 0x80) >> 7);
 
                dmabuf = (u16 *) saa->dmadebi;
                newdma = (u8 *) saa->dmadebi;
                if (NewCard) {  /* SDM2xxx */
                        if (!strncmp(bitdata->loadwhat, "decoder2", 8))
                                continue;       /* fpga not for this card */
-                       if (!strncmp(&saa->boardcfg[42],
-                                    bitdata->loadwhat, 8)) {
+                       if (!strncmp(&saa->boardcfg[42], bitdata->loadwhat, 8))
                                loadfile = 1;
-                       else if (loadtwo && !strncmp(&saa->boardcfg[19],
-                                  bitdata->loadwhat, 8)) {
+                       else if (loadtwo && !strncmp(&saa->boardcfg[19],
+                                      bitdata->loadwhat, 8))
                                loadfile = 2;
-                       } else if (!saa->boardcfg[42] &&        /* special */
-                                  !strncmp("decxl", bitdata->loadwhat, 8)) {
-                               loadfile = 1;
-                       else
+                       else if (!saa->boardcfg[42] && !strncmp("decxl",
+                                       bitdata->loadwhat, 8))
+                               loadfile = 1;   /* special */
+                       else
                                continue;       /* fpga not for this card */
-                       if (loadfile != 1 && loadfile != 2) {
+                       if (loadfile != 1 && loadfile != 2)
                                continue;       /* skip to next card */
-                       }
-                       if (saa->boardcfg[0] && loadfile == 1 )
+                       if (saa->boardcfg[0] && loadfile == 1)
                                continue;       /* skip to next card */
                        if (saa->boardcfg[0] != 1 && loadfile == 2)
                                continue;       /* skip to next card */
@@ -870,8 +838,9 @@ static int initialize_fpga(struct video_code *bitdata)
                /* Release Xilinx INIT signal (WS2) */
                saawrite(0x00000000, SAA7146_GPIO_CTRL);
                /* Wait for the INIT to go High */
-               for (i = 0; i < 10000 &&
-                    !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2); i++)
+               for (i = 0;
+                       i < 10000 && !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2);
+                       i++)
                        schedule();
                if (i == 1000) {
                        printk(KERN_INFO "stradis%d: no fpga INIT\n", saa->nr);
@@ -881,17 +850,13 @@ send_fpga_stuff:
                if (NewCard) {
                        for (i = startindex; i < bitdata->datasize; i++)
                                newdma[i - startindex] =
-                                       bitmangler[bitdata->data[i]];
+                                   bitmangler[bitdata->data[i]];
                        debiwrite(saa, 0x01420000, 0, 0,
                                ((bitdata->datasize - startindex) + 5));
-                       if (loadtwo) {
-                               if (loadfile == 1) {
-                                       printk("stradis%d: "
-                                               "awaiting 2nd FPGA bitfile\n",
-                                               saa->nr);
-                                       continue;       /* skip to next card */
-                               }
-
+                       if (loadtwo && loadfile == 1) {
+                               printk("stradis%d: awaiting 2nd FPGA bitfile\n",
+                                      saa->nr);
+                               continue;       /* skip to next card */
                        }
                } else {
                        for (i = startindex; i < bitdata->datasize; i++)
@@ -900,8 +865,9 @@ send_fpga_stuff:
                        debiwrite(saa, 0x014a0000, 0, 0,
                                ((bitdata->datasize - startindex) + 5) * 2);
                }
-               for (i = 0; i < 1000 &&
-                    !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2); i++)
+               for (i = 0;
+                       i < 1000 && !(saaread(SAA7146_PSR) & SAA7146_PSR_PIN2);
+                       i++)
                        schedule();
                if (i == 1000) {
                        printk(KERN_INFO "stradis%d: FPGA load failed\n",
@@ -925,14 +891,14 @@ send_fpga_stuff:
                        /* mute CS3310 */
                        if (HaveCS3310)
                                debiwrite(saa, debNormal, XILINX_CS3310_CMPLT,
-                                         0, 2);
+                                       0, 2);
                        /* set VXCO to PWM mode, release reset, blank on */
                        debiwrite(saa, debNormal, XILINX_CTL0, 0xffc4, 2);
                        mdelay(10);
                        /* unmute CS3310 */
                        if (HaveCS3310)
                                debiwrite(saa, debNormal, XILINX_CTL0,
-                                         0x2020, 2);
+                                       0x2020, 2);
                }
                /* set source Black */
                debiwrite(saa, debNormal, XILINX_CTL0, 0x1707, 2);
@@ -958,10 +924,10 @@ send_fpga_stuff:
                        /* we must init CS8420 first since rev b pulls i2s */
                        /* master clock low and CS4341 needs i2s master to */
                        /* run the i2c port. */
-                       if (HaveCS8420) {
+                       if (HaveCS8420)
                                /* 0=consumer, 1=pro */
                                initialize_cs8420(saa, 0);
-                       }
+
                        mdelay(5);
                        if (HaveCS4341)
                                initialize_cs4341(saa);
@@ -981,6 +947,7 @@ send_fpga_stuff:
                debiwrite(saa, debNormal, XILINX_CTL0, 0x8080, 2);
 #endif
        }
+
        return failure;
 }
 
@@ -1021,10 +988,10 @@ static int do_ibm_reset(struct saa7146 *saa)
                /* we must init CS8420 first since rev b pulls i2s */
                /* master clock low and CS4341 needs i2s master to */
                /* run the i2c port. */
-               if (HaveCS8420) {
+               if (HaveCS8420)
                        /* 0=consumer, 1=pro */
                        initialize_cs8420(saa, 1);
-               }
+
                mdelay(5);
                if (HaveCS4341)
                        initialize_cs4341(saa);
@@ -1039,12 +1006,12 @@ static int do_ibm_reset(struct saa7146 *saa)
        debiwrite(saa, debNormal, IBM_MP2_OSD_SIZE, 0x2000, 2);
        debiwrite(saa, debNormal, IBM_MP2_AUD_CTL, 0x4552, 2);
        if (ibm_send_command(saa, IBM_MP2_CONFIG_DECODER,
-               (ChipControl == 0x43 ? 0xe800 : 0xe000), 1)) {
+                       (ChipControl == 0x43 ? 0xe800 : 0xe000), 1)) {
                printk(KERN_ERR "stradis%d: IBM config failed\n", saa->nr);
        }
        if (HaveCS3310) {
                int i = CS3310MaxLvl;
-               debiwrite(saa, debNormal, XILINX_CS3310_CMPLT, ((i<<8)|i), 2);
+               debiwrite(saa, debNormal, XILINX_CS3310_CMPLT, ((i << 8)| i),2);
        }
        /* start video decoder */
        debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL, ChipControl, 2);
@@ -1057,6 +1024,7 @@ static int do_ibm_reset(struct saa7146 *saa)
        /* clear pending interrupts */
        debiread(saa, debNormal, IBM_MP2_HOST_INT, 2);
        debiwrite(saa, debNormal, XILINX_CTL0, 0x1711, 2);
+
        return 0;
 }
 
@@ -1070,8 +1038,8 @@ static int initialize_ibmmpeg2(struct video_code *microcode)
                saa = &saa7146s[num];
                /* check that FPGA is loaded */
                debiwrite(saa, debNormal, IBM_MP2_OSD_SIZE, 0xa55a, 2);
-               if ((i = debiread(saa, debNormal, IBM_MP2_OSD_SIZE, 2)) !=
-                    0xa55a) {
+               i = debiread(saa, debNormal, IBM_MP2_OSD_SIZE, 2);
+               if (i != 0xa55a) {
                        printk(KERN_INFO "stradis%d: %04x != 0xa55a\n",
                                saa->nr, i);
 #if 0
@@ -1082,17 +1050,17 @@ static int initialize_ibmmpeg2(struct video_code *microcode)
                        if (saa->boardcfg[0] > 27)
                                continue;       /* skip to next card */
                        /* load video control store */
-                       saa->boardcfg[1] = 0x13;  /* no-sync default */
+                       saa->boardcfg[1] = 0x13;        /* no-sync default */
                        debiwrite(saa, debNormal, IBM_MP2_WR_PROT, 1, 2);
                        debiwrite(saa, debNormal, IBM_MP2_PROC_IADDR, 0, 2);
                        for (i = 0; i < microcode->datasize / 2; i++)
                                debiwrite(saa, debNormal, IBM_MP2_PROC_IDATA,
                                        (microcode->data[i * 2] << 8) |
-                                        microcode->data[i * 2 + 1], 2);
+                                       microcode->data[i * 2 + 1], 2);
                        debiwrite(saa, debNormal, IBM_MP2_PROC_IADDR, 0, 2);
                        debiwrite(saa, debNormal, IBM_MP2_WR_PROT, 0, 2);
                        debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL,
-                                 ChipControl, 2);
+                               ChipControl, 2);
                        saa->boardcfg[0] = 28;
                }
                if (!strncmp(microcode->loadwhat, "decoder.aud", 11)) {
@@ -1109,34 +1077,32 @@ static int initialize_ibmmpeg2(struct video_code *microcode)
                        debiwrite(saa, debNormal, IBM_MP2_OSD_SIZE, 0x2000, 2);
                        debiwrite(saa, debNormal, IBM_MP2_AUD_CTL, 0x4552, 2);
                        if (ibm_send_command(saa, IBM_MP2_CONFIG_DECODER,
-                           0xe000, 1)) {
-                               printk(KERN_ERR
-                                      "stradis%d: IBM config failed\n",
-                                      saa->nr);
+                                       0xe000, 1)) {
+                               printk(KERN_ERR "stradis%d: IBM config "
+                                       "failed\n", saa->nr);
                                return -1;
                        }
                        /* set PWM to center value */
                        if (NewCard) {
                                debiwrite(saa, debNormal, XILINX_PWM,
-                                         saa->boardcfg[14] +
-                                         (saa->boardcfg[13]<<8), 2);
+                                       saa->boardcfg[14] +
+                                       (saa->boardcfg[13] << 8), 2);
                        } else
-                               debiwrite(saa, debNormal, XILINX_PWM,
-                                         0x46, 2);
+                               debiwrite(saa, debNormal, XILINX_PWM, 0x46, 2);
+
                        if (HaveCS3310) {
                                i = CS3310MaxLvl;
-                               debiwrite(saa, debNormal,
-                                       XILINX_CS3310_CMPLT, ((i<<8)|i), 2);
+                               debiwrite(saa, debNormal, XILINX_CS3310_CMPLT,
+                                       (i << 8) | i, 2);
                        }
-                       printk(KERN_INFO
-                              "stradis%d: IBM MPEGCD%d Initialized\n",
-                              saa->nr, 18 + (debiread(saa, debNormal,
-                              IBM_MP2_CHIP_CONTROL, 2) >> 12));
+                       printk(KERN_INFO "stradis%d: IBM MPEGCD%d Inited\n",
+                               saa->nr, 18 + (debiread(saa, debNormal,
+                               IBM_MP2_CHIP_CONTROL, 2) >> 12));
                        /* start video decoder */
                        debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL,
                                ChipControl, 2);
-                       debiwrite(saa, debNormal, IBM_MP2_RB_THRESHOLD,
-                               0x4037, 2);     /* 256k vid, 3520 bytes aud */
+                       debiwrite(saa, debNormal, IBM_MP2_RB_THRESHOLD, 0x4037,
+                               2);     /* 256k vid, 3520 bytes aud */
                        debiwrite(saa, debNormal, IBM_MP2_AUD_CTL, 0x4573, 2);
                        ibm_send_command(saa, IBM_MP2_PLAY, 0, 0);
                        /* enable buffer threshold irq */
@@ -1149,52 +1115,48 @@ static int initialize_ibmmpeg2(struct video_code *microcode)
                        saa->boardcfg[0] = 37;
                }
        }
+
        return 0;
 }
 
-static u32 palette2fmt[] =
-{                              /* some of these YUV translations are wrong */
-  0xffffffff, 0x86000000, 0x87000000, 0x80000000, 0x8100000, 0x82000000,
-  0x83000000, 0x00000000, 0x03000000, 0x03000000, 0x0a00000, 0x03000000,
-  0x06000000, 0x00000000, 0x03000000, 0x0a000000, 0x0300000
+static u32 palette2fmt[] = {   /* some of these YUV translations are wrong */
+       0xffffffff, 0x86000000, 0x87000000, 0x80000000, 0x8100000, 0x82000000,
+       0x83000000, 0x00000000, 0x03000000, 0x03000000, 0x0a00000, 0x03000000,
+       0x06000000, 0x00000000, 0x03000000, 0x0a000000, 0x0300000
 };
-static int bpp2fmt[4] =
-{
+static int bpp2fmt[4] = {
        VIDEO_PALETTE_HI240, VIDEO_PALETTE_RGB565, VIDEO_PALETTE_RGB24,
        VIDEO_PALETTE_RGB32
 };
 
 /* I wish I could find a formula to calculate these... */
-static u32 h_prescale[64] =
-{
-  0x10000000, 0x18040202, 0x18080000, 0x380c0606, 0x38100204, 0x38140808,
-  0x38180000, 0x381c0000, 0x3820161c, 0x38242a3b, 0x38281230, 0x382c4460,
-  0x38301040, 0x38340080, 0x38380000, 0x383c0000, 0x3840fefe, 0x3844ee9f,
-  0x3848ee9f, 0x384cee9f, 0x3850ee9f, 0x38542a3b, 0x38581230, 0x385c0000,
-  0x38600000, 0x38640000, 0x38680000, 0x386c0000, 0x38700000, 0x38740000,
-  0x38780000, 0x387c0000, 0x30800000, 0x38840000, 0x38880000, 0x388c0000,
-  0x38900000, 0x38940000, 0x38980000, 0x389c0000, 0x38a00000, 0x38a40000,
-  0x38a80000, 0x38ac0000, 0x38b00000, 0x38b40000, 0x38b80000, 0x38bc0000,
-  0x38c00000, 0x38c40000, 0x38c80000, 0x38cc0000, 0x38d00000, 0x38d40000,
-  0x38d80000, 0x38dc0000, 0x38e00000, 0x38e40000, 0x38e80000, 0x38ec0000,
-  0x38f00000, 0x38f40000, 0x38f80000, 0x38fc0000,
+static u32 h_prescale[64] = {
+       0x10000000, 0x18040202, 0x18080000, 0x380c0606, 0x38100204, 0x38140808,
+       0x38180000, 0x381c0000, 0x3820161c, 0x38242a3b, 0x38281230, 0x382c4460,
+       0x38301040, 0x38340080, 0x38380000, 0x383c0000, 0x3840fefe, 0x3844ee9f,
+       0x3848ee9f, 0x384cee9f, 0x3850ee9f, 0x38542a3b, 0x38581230, 0x385c0000,
+       0x38600000, 0x38640000, 0x38680000, 0x386c0000, 0x38700000, 0x38740000,
+       0x38780000, 0x387c0000, 0x30800000, 0x38840000, 0x38880000, 0x388c0000,
+       0x38900000, 0x38940000, 0x38980000, 0x389c0000, 0x38a00000, 0x38a40000,
+       0x38a80000, 0x38ac0000, 0x38b00000, 0x38b40000, 0x38b80000, 0x38bc0000,
+       0x38c00000, 0x38c40000, 0x38c80000, 0x38cc0000, 0x38d00000, 0x38d40000,
+       0x38d80000, 0x38dc0000, 0x38e00000, 0x38e40000, 0x38e80000, 0x38ec0000,
+       0x38f00000, 0x38f40000, 0x38f80000, 0x38fc0000,
 };
-static u32 v_gain[64] =
-{
-  0x016000ff, 0x016100ff, 0x016100ff, 0x016200ff, 0x016200ff, 0x016200ff,
-  0x016200ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff,
-  0x016300ff, 0x016300ff, 0x016300ff, 0x016400ff, 0x016400ff, 0x016400ff,
-  0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
-  0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
-  0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
-  0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
-  0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
-  0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
-  0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
-  0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
+static u32 v_gain[64] = {
+       0x016000ff, 0x016100ff, 0x016100ff, 0x016200ff, 0x016200ff, 0x016200ff,
+       0x016200ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff, 0x016300ff,
+       0x016300ff, 0x016300ff, 0x016300ff, 0x016400ff, 0x016400ff, 0x016400ff,
+       0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
+       0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
+       0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
+       0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
+       0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
+       0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
+       0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
+       0x016400ff, 0x016400ff, 0x016400ff, 0x016400ff,
 };
 
-
 static void saa7146_set_winsize(struct saa7146 *saa)
 {
        u32 format;
@@ -1209,24 +1171,23 @@ static void saa7146_set_winsize(struct saa7146 *saa)
        saawrite(saa->win.vidadr + saa->win.bpl * saa->win.sheight,
                 SAA7146_PROT_ADDR1);
        saawrite(0, SAA7146_PAGE1);
-       saawrite(format|0x60, SAA7146_CLIP_FORMAT_CTRL);
+       saawrite(format | 0x60, SAA7146_CLIP_FORMAT_CTRL);
        offset = (704 / (saa->win.width - 1)) & 0x3f;
        saawrite(h_prescale[offset], SAA7146_HPS_H_PRESCALE);
        offset = (720896 / saa->win.width) / (offset + 1);
-       saawrite((offset<<12)|0x0c, SAA7146_HPS_H_SCALE);
+       saawrite((offset << 12) | 0x0c, SAA7146_HPS_H_SCALE);
        if (CurrentMode == VIDEO_MODE_NTSC) {
-               yacl = /*(480 / saa->win.height - 1) & 0x3f*/ 0;
+               yacl = /*(480 / saa->win.height - 1) & 0x3f */ 0;
                ysci = 1024 - (saa->win.height * 1024 / 480);
        } else {
-               yacl = /*(576 / saa->win.height - 1) & 0x3f*/ 0;
+               yacl = /*(576 / saa->win.height - 1) & 0x3f */ 0;
                ysci = 1024 - (saa->win.height * 1024 / 576);
        }
-       saawrite((1<<31)|(ysci<<21)|(yacl<<15), SAA7146_HPS_V_SCALE);
+       saawrite((1 << 31) | (ysci << 21) | (yacl << 15), SAA7146_HPS_V_SCALE);
        saawrite(v_gain[yacl], SAA7146_HPS_V_GAIN);
        saawrite(((SAA7146_MC2_UPLD_DMA1 | SAA7146_MC2_UPLD_HPS_V |
-                  SAA7146_MC2_UPLD_HPS_H) << 16) | (SAA7146_MC2_UPLD_DMA1 |
-                  SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_HPS_H),
-                  SAA7146_MC2);
+               SAA7146_MC2_UPLD_HPS_H) << 16) | (SAA7146_MC2_UPLD_DMA1 |
+               SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_HPS_H), SAA7146_MC2);
 }
 
 /* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area
@@ -1261,8 +1222,8 @@ static void clip_draw_rectangle(u32 *clipmap, int x, int y, int w, int h)
        startword = (x >> 5);
        endword = ((x + w) >> 5);
        bitsleft = (0xffffffff >> (x & 31));
-       bitsright = (0xffffffff << (~((x + w) - (endword<<5))));
-       temp = &clipmap[(y<<5) + startword];
+       bitsright = (0xffffffff << (~((x + w) - (endword << 5))));
+       temp = &clipmap[(y << 5) + startword];
        w = endword - startword;
        if (!w) {
                bitsleft |= bitsright;
@@ -1287,13 +1248,13 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr)
        u32 *clipmap;
 
        clipmap = saa->dmavid2;
-       if((width=saa->win.width)>1023)
-               width = 1023;           /* sanity check */
-       if((height=saa->win.height)>640)
-               height = 639;           /* sanity check */
-       if (ncr > 0) {  /* rectangles pased */
+       if ((width = saa->win.width) > 1023)
+               width = 1023;   /* sanity check */
+       if ((height = saa->win.height) > 640)
+               height = 639;   /* sanity check */
+       if (ncr > 0) {          /* rectangles pased */
                /* convert rectangular clips to a bitmap */
-               memset(clipmap, 0, VIDEO_CLIPMAP_SIZE); /* clear map */
+               memset(clipmap, 0, VIDEO_CLIPMAP_SIZE); /* clear map */
                for (i = 0; i < ncr; i++)
                        clip_draw_rectangle(clipmap, cr[i].x, cr[i].y,
                                cr[i].width, cr[i].height);
@@ -1301,14 +1262,15 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr)
        /* clip against viewing window AND screen 
           so we do not have to rely on the user program
         */
-       clip_draw_rectangle(clipmap,(saa->win.x+width>saa->win.swidth) ?
-               (saa->win.swidth-saa->win.x) : width, 0, 1024, 768);
-       clip_draw_rectangle(clipmap,0,(saa->win.y+height>saa->win.sheight) ?
-               (saa->win.sheight-saa->win.y) : height,1024,768);
-       if (saa->win.x<0)
-               clip_draw_rectangle(clipmap, 0, 0, -(saa->win.x), 768);
-       if (saa->win.y<0)
-               clip_draw_rectangle(clipmap, 0, 0, 1024, -(saa->win.y));
+       clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ?
+               (saa->win.swidth - saa->win.x) : width, 0, 1024, 768);
+       clip_draw_rectangle(clipmap, 0,
+               (saa->win.y + height > saa->win.sheight) ?
+               (saa->win.sheight - saa->win.y) : height, 1024, 768);
+       if (saa->win.x < 0)
+               clip_draw_rectangle(clipmap, 0, 0, -saa->win.x, 768);
+       if (saa->win.y < 0)
+               clip_draw_rectangle(clipmap, 0, 0, 1024, -saa->win.y);
 }
 
 static int saa_ioctl(struct inode *inode, struct file *file,
@@ -1322,11 +1284,9 @@ static int saa_ioctl(struct inode *inode, struct file *file,
                {
                        struct video_capability b;
                        strcpy(b.name, saa->video_dev.name);
-                       b.type = VID_TYPE_CAPTURE |
-                           VID_TYPE_OVERLAY |
-                           VID_TYPE_CLIPPING |
-                           VID_TYPE_FRAMERAM |
-                           VID_TYPE_SCALES;
+                       b.type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY |
+                               VID_TYPE_CLIPPING | VID_TYPE_FRAMERAM |
+                               VID_TYPE_SCALES;
                        b.channels = 1;
                        b.audios = 1;
                        b.maxwidth = 768;
@@ -1363,17 +1323,18 @@ static int saa_ioctl(struct inode *inode, struct file *file,
                        if (p.palette < sizeof(palette2fmt) / sizeof(u32)) {
                                format = palette2fmt[p.palette];
                                saa->win.color_fmt = format;
-                               saawrite(format|0x60, SAA7146_CLIP_FORMAT_CTRL);
+                               saawrite(format | 0x60,
+                                       SAA7146_CLIP_FORMAT_CTRL);
                        }
                        saawrite(((p.brightness & 0xff00) << 16) |
-                                ((p.contrast & 0xfe00) << 7) |
-                            ((p.colour & 0xfe00) >> 9), SAA7146_BCS_CTRL);
+                               ((p.contrast & 0xfe00) << 7) |
+                               ((p.colour & 0xfe00) >> 9), SAA7146_BCS_CTRL);
                        saa->picture = p;
                        /* upload changed registers */
                        saawrite(((SAA7146_MC2_UPLD_HPS_H |
-                                SAA7146_MC2_UPLD_HPS_V) << 16) |
-                               SAA7146_MC2_UPLD_HPS_H | SAA7146_MC2_UPLD_HPS_V,
-                                SAA7146_MC2);
+                               SAA7146_MC2_UPLD_HPS_V) << 16) |
+                               SAA7146_MC2_UPLD_HPS_H |
+                               SAA7146_MC2_UPLD_HPS_V, SAA7146_MC2);
                        return 0;
                }
        case VIDIOCSWIN:
@@ -1384,11 +1345,14 @@ static int saa_ioctl(struct inode *inode, struct file *file,
                        if (copy_from_user(&vw, arg, sizeof(vw)))
                                return -EFAULT;
 
-                       if (vw.flags || vw.width < 16 || vw.height < 16) {      /* stop capture */
-                               saawrite((SAA7146_MC1_TR_E_1 << 16), SAA7146_MC1);
+                       /* stop capture */
+                       if (vw.flags || vw.width < 16 || vw.height < 16) {
+                               saawrite((SAA7146_MC1_TR_E_1 << 16),
+                                       SAA7146_MC1);
                                return -EINVAL;
                        }
-                       if (saa->win.bpp < 4) {         /* 32-bit align start and adjust width */
+                       /* 32-bit align start and adjust width */
+                       if (saa->win.bpp < 4) {
                                int i = vw.x;
                                vw.x = (vw.x + 3) & ~3;
                                i = vw.x - i;
@@ -1417,23 +1381,24 @@ static int saa_ioctl(struct inode *inode, struct file *file,
                         */
                        if (vw.clipcount < 0) {
                                if (copy_from_user(saa->dmavid2, vw.clips,
-                                                  VIDEO_CLIPMAP_SIZE))
+                                               VIDEO_CLIPMAP_SIZE))
                                        return -EFAULT;
-                       }
-                       else if (vw.clipcount > 16384) {
+                       } else if (vw.clipcount > 16384) {
                                return -EINVAL;
                        } else if (vw.clipcount > 0) {
-                               if ((vcp = vmalloc(sizeof(struct video_clip) *
-                                               (vw.clipcount))) == NULL)
-                                        return -ENOMEM;
+                               vcp = vmalloc(sizeof(struct video_clip) *
+                                       vw.clipcount);
+                               if (vcp == NULL)
+                                       return -ENOMEM;
                                if (copy_from_user(vcp, vw.clips,
-                                             sizeof(struct video_clip) *
-                                                  vw.clipcount)) {
+                                               sizeof(struct video_clip) *
+                                               vw.clipcount)) {
                                        vfree(vcp);
                                        return -EFAULT;
                                }
                        } else  /* nothing clipped */
                                memset(saa->dmavid2, 0, VIDEO_CLIPMAP_SIZE);
+
                        make_clip_tab(saa, vcp, vw.clipcount);
                        if (vw.clipcount > 0)
                                vfree(vcp);
@@ -1466,21 +1431,21 @@ static int saa_ioctl(struct inode *inode, struct file *file,
                        if (v == 0) {
                                saa->cap &= ~1;
                                saawrite((SAA7146_MC1_TR_E_1 << 16),
-                                        SAA7146_MC1);
+                                       SAA7146_MC1);
                        } else {
                                if (saa->win.vidadr == 0 || saa->win.width == 0
-                                   || saa->win.height == 0)
+                                               || saa->win.height == 0)
                                        return -EINVAL;
                                saa->cap |= 1;
                                saawrite((SAA7146_MC1_TR_E_1 << 16) | 0xffff,
-                                        SAA7146_MC1);
+                                       SAA7146_MC1);
                        }
                        return 0;
                }
        case VIDIOCGFBUF:
                {
                        struct video_buffer v;
-                       v.base = (void *) saa->win.vidadr;
+                       v.base = (void *)saa->win.vidadr;
                        v.height = saa->win.sheight;
                        v.width = saa->win.swidth;
                        v.depth = saa->win.depth;
@@ -1498,19 +1463,20 @@ static int saa_ioctl(struct inode *inode, struct file *file,
                        if (copy_from_user(&v, arg, sizeof(v)))
                                return -EFAULT;
                        if (v.depth != 8 && v.depth != 15 && v.depth != 16 &&
-                       v.depth != 24 && v.depth != 32 && v.width > 16 &&
+                           v.depth != 24 && v.depth != 32 && v.width > 16 &&
                            v.height > 16 && v.bytesperline > 16)
                                return -EINVAL;
                        if (v.base)
-                               saa->win.vidadr = (unsigned long) v.base;
+                               saa->win.vidadr = (unsigned long)v.base;
                        saa->win.sheight = v.height;
                        saa->win.swidth = v.width;
                        saa->win.bpp = ((v.depth + 7) & 0x38) / 8;
                        saa->win.depth = v.depth;
                        saa->win.bpl = v.bytesperline;
 
-                       DEBUG(printk("Display at %p is %d by %d, bytedepth %d, bpl %d\n",
-                                    v.base, v.width, v.height, saa->win.bpp, saa->win.bpl));
+                       DEBUG(printk("Display at %p is %d by %d, bytedepth %d, "
+                                       "bpl %d\n", v.base, v.width, v.height,
+                                       saa->win.bpp, saa->win.bpl));
                        saa7146_set_winsize(saa);
                        return 0;
                }
@@ -1538,21 +1504,18 @@ static int saa_ioctl(struct inode *inode, struct file *file,
                        int i;
                        if (copy_from_user(&v, arg, sizeof(v)))
                                return -EFAULT;
-                       i = (~(v.volume>>8))&0xff;
+                       i = (~(v.volume >> 8)) & 0xff;
                        if (!HaveCS4341) {
-                               if (v.flags & VIDEO_AUDIO_MUTE) {
+                               if (v.flags & VIDEO_AUDIO_MUTE)
                                        debiwrite(saa, debNormal,
-                                               IBM_MP2_FRNT_ATTEN,
-                                               0xffff, 2);
-                               }
+                                               IBM_MP2_FRNT_ATTEN, 0xffff, 2);
                                if (!(v.flags & VIDEO_AUDIO_MUTE))
                                        debiwrite(saa, debNormal,
-                                               IBM_MP2_FRNT_ATTEN,
-                                                 0x0000, 2);
+                                               IBM_MP2_FRNT_ATTEN, 0x0000, 2);
                                if (v.flags & VIDEO_AUDIO_VOLUME)
                                        debiwrite(saa, debNormal,
                                                IBM_MP2_FRNT_ATTEN,
-                                               (i<<8)|i, 2);
+                                               (i << 8) | i, 2);
                        } else {
                                if (v.flags & VIDEO_AUDIO_MUTE)
                                        cs4341_setlevel(saa, 0xff, 0xff);
@@ -1580,163 +1543,138 @@ static int saa_ioctl(struct inode *inode, struct file *file,
        case VIDIOCSPLAYMODE:
                {
                        struct video_play_mode pmode;
-                       if (copy_from_user((void *) &pmode, arg,
-                               sizeof(struct video_play_mode)))
+                       if (copy_from_user((void *)&pmode, arg,
+                                       sizeof(struct video_play_mode)))
                                return -EFAULT;
                        switch (pmode.mode) {
-                               case VID_PLAY_VID_OUT_MODE:
-                                       if (pmode.p1 != VIDEO_MODE_NTSC &&
+                       case VID_PLAY_VID_OUT_MODE:
+                               if (pmode.p1 != VIDEO_MODE_NTSC &&
                                                pmode.p1 != VIDEO_MODE_PAL)
-                                               return -EINVAL;
-                                       set_out_format(saa, pmode.p1);
-                                       return 0;
-                               case VID_PLAY_GENLOCK:
-                                       debiwrite(saa, debNormal,
-                                                 XILINX_CTL0,
-                                                 (pmode.p1 ? 0x8000 : 0x8080),
-                                                 2);
-                                       if (NewCard)
-                                               set_genlock_offset(saa,
-                                                       pmode.p2);
-                                       return 0;
-                               case VID_PLAY_NORMAL:
-                                       debiwrite(saa, debNormal,
-                                               IBM_MP2_CHIP_CONTROL,
-                                               ChipControl, 2);
-                                       ibm_send_command(saa,
-                                               IBM_MP2_PLAY, 0, 0);
-                                       saa->playmode = pmode.mode;
-                                       return 0;
-                               case VID_PLAY_PAUSE:
-                                       /* IBM removed the PAUSE command */
-                                       /* they say use SINGLE_FRAME now */
-                               case VID_PLAY_SINGLE_FRAME:
-                                       ibm_send_command(saa,
-                                                       IBM_MP2_SINGLE_FRAME,
-                                                       0, 0);
-                                       if (saa->playmode == pmode.mode) {
-                                               debiwrite(saa, debNormal,
-                                                       IBM_MP2_CHIP_CONTROL,
-                                                       ChipControl, 2);
-                                       }
-                                       saa->playmode = pmode.mode;
-                                       return 0;
-                               case VID_PLAY_FAST_FORWARD:
-                                       ibm_send_command(saa,
-                                               IBM_MP2_FAST_FORWARD, 0, 0);
-                                       saa->playmode = pmode.mode;
-                                       return 0;
-                               case VID_PLAY_SLOW_MOTION:
-                                       ibm_send_command(saa,
-                                               IBM_MP2_SLOW_MOTION,
-                                               pmode.p1, 0);
-                                       saa->playmode = pmode.mode;
-                                       return 0;
-                               case VID_PLAY_IMMEDIATE_NORMAL:
-                                       /* ensure transfers resume */
-                                       debiwrite(saa, debNormal,
-                                               IBM_MP2_CHIP_CONTROL,
-                                               ChipControl, 2);
-                                       ibm_send_command(saa,
-                                               IBM_MP2_IMED_NORM_PLAY, 0, 0);
-                                       saa->playmode = VID_PLAY_NORMAL;
-                                       return 0;
-                               case VID_PLAY_SWITCH_CHANNELS:
-                                       saa->audhead = saa->audtail = 0;
-                                       saa->vidhead = saa->vidtail = 0;
-                                       ibm_send_command(saa,
-                                               IBM_MP2_FREEZE_FRAME, 0, 1);
-                                       ibm_send_command(saa,
-                                               IBM_MP2_RESET_AUD_RATE, 0, 1);
-                                       debiwrite(saa, debNormal,
-                                               IBM_MP2_CHIP_CONTROL, 0, 2);
-                                       ibm_send_command(saa,
-                                               IBM_MP2_CHANNEL_SWITCH, 0, 1);
+                                       return -EINVAL;
+                               set_out_format(saa, pmode.p1);
+                               return 0;
+                       case VID_PLAY_GENLOCK:
+                               debiwrite(saa, debNormal, XILINX_CTL0,
+                                       pmode.p1 ? 0x8000 : 0x8080, 2);
+                               if (NewCard)
+                                       set_genlock_offset(saa, pmode.p2);
+                               return 0;
+                       case VID_PLAY_NORMAL:
+                               debiwrite(saa, debNormal,
+                                       IBM_MP2_CHIP_CONTROL, ChipControl, 2);
+                               ibm_send_command(saa, IBM_MP2_PLAY, 0, 0);
+                               saa->playmode = pmode.mode;
+                               return 0;
+                       case VID_PLAY_PAUSE:
+                               /* IBM removed the PAUSE command */
+                               /* they say use SINGLE_FRAME now */
+                       case VID_PLAY_SINGLE_FRAME:
+                               ibm_send_command(saa, IBM_MP2_SINGLE_FRAME,0,0);
+                               if (saa->playmode == pmode.mode) {
                                        debiwrite(saa, debNormal,
                                                IBM_MP2_CHIP_CONTROL,
                                                ChipControl, 2);
-                                       ibm_send_command(saa,
-                                               IBM_MP2_PLAY, 0, 0);
-                                       saa->playmode = VID_PLAY_NORMAL;
-                                       return 0;
-                               case VID_PLAY_FREEZE_FRAME:
-                                       ibm_send_command(saa,
-                                               IBM_MP2_FREEZE_FRAME, 0, 0);
-                                       saa->playmode = pmode.mode;
-                                       return 0;
-                               case VID_PLAY_STILL_MODE:
-                                       ibm_send_command(saa,
-                                               IBM_MP2_SET_STILL_MODE, 0, 0);
-                                       saa->playmode = pmode.mode;
-                                       return 0;
-                               case VID_PLAY_MASTER_MODE:
-                                       if (pmode.p1 == VID_PLAY_MASTER_NONE)
-                                               saa->boardcfg[1] = 0x13;
-                                       else if (pmode.p1 ==
-                                               VID_PLAY_MASTER_VIDEO)
-                                               saa->boardcfg[1] = 0x23;
-                                       else if (pmode.p1 ==
-                                               VID_PLAY_MASTER_AUDIO)
-                                               saa->boardcfg[1] = 0x43;
-                                       else
+                               }
+                               saa->playmode = pmode.mode;
+                               return 0;
+                       case VID_PLAY_FAST_FORWARD:
+                               ibm_send_command(saa, IBM_MP2_FAST_FORWARD,0,0);
+                               saa->playmode = pmode.mode;
+                               return 0;
+                       case VID_PLAY_SLOW_MOTION:
+                               ibm_send_command(saa, IBM_MP2_SLOW_MOTION,
+                                       pmode.p1, 0);
+                               saa->playmode = pmode.mode;
+                               return 0;
+                       case VID_PLAY_IMMEDIATE_NORMAL:
+                               /* ensure transfers resume */
+                               debiwrite(saa, debNormal,
+                                       IBM_MP2_CHIP_CONTROL, ChipControl, 2);
+                               ibm_send_command(saa, IBM_MP2_IMED_NORM_PLAY,
+                                       0, 0);
+                               saa->playmode = VID_PLAY_NORMAL;
+                               return 0;
+                       case VID_PLAY_SWITCH_CHANNELS:
+                               saa->audhead = saa->audtail = 0;
+                               saa->vidhead = saa->vidtail = 0;
+                               ibm_send_command(saa, IBM_MP2_FREEZE_FRAME,0,1);
+                               ibm_send_command(saa, IBM_MP2_RESET_AUD_RATE,
+                                       0, 1);
+                               debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL,
+                                       0, 2);
+                               ibm_send_command(saa, IBM_MP2_CHANNEL_SWITCH,
+                                       0, 1);
+                               debiwrite(saa, debNormal, IBM_MP2_CHIP_CONTROL,
+                                       ChipControl, 2);
+                               ibm_send_command(saa, IBM_MP2_PLAY, 0, 0);
+                               saa->playmode = VID_PLAY_NORMAL;
+                               return 0;
+                       case VID_PLAY_FREEZE_FRAME:
+                               ibm_send_command(saa, IBM_MP2_FREEZE_FRAME,0,0);
+                               saa->playmode = pmode.mode;
+                               return 0;
+                       case VID_PLAY_STILL_MODE:
+                               ibm_send_command(saa, IBM_MP2_SET_STILL_MODE,
+                                       0, 0);
+                               saa->playmode = pmode.mode;
+                               return 0;
+                       case VID_PLAY_MASTER_MODE:
+                               if (pmode.p1 == VID_PLAY_MASTER_NONE)
+                                       saa->boardcfg[1] = 0x13;
+                               else if (pmode.p1 == VID_PLAY_MASTER_VIDEO)
+                                       saa->boardcfg[1] = 0x23;
+                               else if (pmode.p1 == VID_PLAY_MASTER_AUDIO)
+                                       saa->boardcfg[1] = 0x43;
+                               else
+                                       return -EINVAL;
+                               debiwrite(saa, debNormal,
+                                         IBM_MP2_CHIP_CONTROL, ChipControl, 2);
+                               return 0;
+                       case VID_PLAY_ACTIVE_SCANLINES:
+                               if (CurrentMode == VIDEO_MODE_PAL) {
+                                       if (pmode.p1 < 1 || pmode.p2 > 625)
                                                return -EINVAL;
-                                       debiwrite(saa, debNormal,
-                                               IBM_MP2_CHIP_CONTROL,
-                                               ChipControl, 2);
-                                       return 0;
-                               case VID_PLAY_ACTIVE_SCANLINES:
-                                       if (CurrentMode == VIDEO_MODE_PAL) {
-                                               if (pmode.p1 < 1 ||
-                                                       pmode.p2 > 625)
-                                                       return -EINVAL;
-                                               saa->boardcfg[5] = pmode.p1;
-                                               saa->boardcfg[55] = (pmode.p1 +
-                                                       (pmode.p2/2) - 1) &     
-                                                       0xff;
-                                       } else {
-                                               if (pmode.p1 < 4 ||
-                                                       pmode.p2 > 525)
-                                                       return -EINVAL;
-                                               saa->boardcfg[4] = pmode.p1;
-                                               saa->boardcfg[54] = (pmode.p1 +
-                                                       (pmode.p2/2) - 4) &
-                                                       0xff;
-                                       }
-                                       set_out_format(saa, CurrentMode);
-                               case VID_PLAY_RESET:
-                                       return do_ibm_reset(saa);
-                               case VID_PLAY_END_MARK:
-                                       if (saa->endmarktail <  
-                                               saa->endmarkhead) {
-                                               if (saa->endmarkhead -
+                                       saa->boardcfg[5] = pmode.p1;
+                                       saa->boardcfg[55] = (pmode.p1 +
+                                               (pmode.p2 / 2) - 1) & 0xff;
+                               } else {
+                                       if (pmode.p1 < 4 || pmode.p2 > 525)
+                                               return -EINVAL;
+                                       saa->boardcfg[4] = pmode.p1;
+                                       saa->boardcfg[54] = (pmode.p1 +
+                                               (pmode.p2 / 2) - 4) & 0xff;
+                               }
+                               set_out_format(saa, CurrentMode);
+                       case VID_PLAY_RESET:
+                               return do_ibm_reset(saa);
+                       case VID_PLAY_END_MARK:
+                               if (saa->endmarktail < saa->endmarkhead) {
+                                       if (saa->endmarkhead -
                                                        saa->endmarktail < 2)
-                                                       return -ENOSPC;
-                                       } else if (saa->endmarkhead <=
-                                               saa->endmarktail) {
-                                               if (saa->endmarktail -
-                                                       saa->endmarkhead >
-                                                       (MAX_MARKS - 2))
-                                                       return -ENOSPC;
-                                       } else
                                                return -ENOSPC;
-                                       saa->endmark[saa->endmarktail] =
-                                               saa->audtail;
-                                       saa->endmarktail++;
-                                       if (saa->endmarktail >= MAX_MARKS)
-                                               saa->endmarktail = 0;
+                               } else if (saa->endmarkhead <=saa->endmarktail){
+                                       if (saa->endmarktail - saa->endmarkhead
+                                                       > (MAX_MARKS - 2))
+                                               return -ENOSPC;
+                               } else
+                                       return -ENOSPC;
+                               saa->endmark[saa->endmarktail] = saa->audtail;
+                               saa->endmarktail++;
+                               if (saa->endmarktail >= MAX_MARKS)
+                                       saa->endmarktail = 0;
                        }
                        return -EINVAL;
                }
        case VIDIOCSWRITEMODE:
                {
                        int mode;
-                       if (copy_from_user((void *) &mode, arg, sizeof(int)))
-                                return -EFAULT;
+                       if (copy_from_user((void *)&mode, arg, sizeof(int)))
+                               return -EFAULT;
                        if (mode == VID_WRITE_MPEG_AUD ||
-                           mode == VID_WRITE_MPEG_VID ||
-                           mode == VID_WRITE_CC ||
-                           mode == VID_WRITE_TTX ||
-                           mode == VID_WRITE_OSD) {
+                                       mode == VID_WRITE_MPEG_VID ||
+                                       mode == VID_WRITE_CC ||
+                                       mode == VID_WRITE_TTX ||
+                                       mode == VID_WRITE_OSD) {
                                saa->writemode = mode;
                                return 0;
                        }
@@ -1750,7 +1688,7 @@ static int saa_ioctl(struct inode *inode, struct file *file,
                        if (copy_from_user(&ucode, arg, sizeof(ucode)))
                                return -EFAULT;
                        if (ucode.datasize > 65536 || ucode.datasize < 1024 ||
-                           strncmp(ucode.loadwhat, "dec", 3))
+                                       strncmp(ucode.loadwhat, "dec", 3))
                                return -EINVAL;
                        if ((udata = vmalloc(ucode.datasize)) == NULL)
                                return -ENOMEM;
@@ -1759,8 +1697,8 @@ static int saa_ioctl(struct inode *inode, struct file *file,
                                return -EFAULT;
                        }
                        ucode.data = udata;
-                       if (!strncmp(ucode.loadwhat, "decoder.aud", 11)
-                               || !strncmp(ucode.loadwhat, "decoder.vid", 11))
+                       if (!strncmp(ucode.loadwhat, "decoder.aud", 11) ||
+                               !strncmp(ucode.loadwhat, "decoder.vid", 11))
                                i = initialize_ibmmpeg2(&ucode);
                        else
                                i = initialize_fpga(&ucode);
@@ -1805,14 +1743,14 @@ static int saa_mmap(struct file *file, struct vm_area_struct *vma)
        return -EINVAL;
 }
 
-static ssize_t saa_read(struct file *file, char __user *buf,
-                       size_t count, loff_t *ppos)
+static ssize_t saa_read(struct file *file, char __user * buf,
+       size_t count, loff_t * ppos)
 {
        return -EINVAL;
 }
 
-static ssize_t saa_write(struct file *file, const char __user *buf,
-                        size_t count, loff_t *ppos)
+static ssize_t saa_write(struct file *file, const char __user * buf,
+       size_t count, loff_t * ppos)
 {
        struct saa7146 *saa = file->private_data;
        unsigned long todo = count;
@@ -1823,20 +1761,22 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
                if (saa->writemode == VID_WRITE_MPEG_AUD) {
                        spin_lock_irqsave(&saa->lock, flags);
                        if (saa->audhead <= saa->audtail)
-                               blocksize = 65536-(saa->audtail - saa->audhead);
+                               blocksize = 65536 -
+                                       (saa->audtail - saa->audhead);
                        else
                                blocksize = saa->audhead - saa->audtail;
                        spin_unlock_irqrestore(&saa->lock, flags);
                        if (blocksize < 16384) {
                                saawrite(SAA7146_PSR_DEBI_S |
-                                        SAA7146_PSR_PIN1, SAA7146_IER);
+                                       SAA7146_PSR_PIN1, SAA7146_IER);
                                saawrite(SAA7146_PSR_PIN1, SAA7146_PSR);
                                /* wait for buffer space to open */
                                interruptible_sleep_on(&saa->audq);
                        }
                        spin_lock_irqsave(&saa->lock, flags);
                        if (saa->audhead <= saa->audtail) {
-                               blocksize = 65536-(saa->audtail - saa->audhead);
+                               blocksize = 65536 -
+                                       (saa->audtail - saa->audhead);
                                split = 65536 - saa->audtail;
                        } else {
                                blocksize = saa->audhead - saa->audtail;
@@ -1851,7 +1791,7 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
                                return -ENOSPC;
                        if (split < blocksize) {
                                if (copy_from_user(saa->audbuf +
-                                       saa->audtail, buf, split)) 
+                                               saa->audtail, buf, split))
                                        return -EFAULT;
                                buf += split;
                                todo -= split;
@@ -1859,7 +1799,7 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
                                saa->audtail = 0;
                        }
                        if (copy_from_user(saa->audbuf + saa->audtail, buf,
-                               blocksize)) 
+                                       blocksize))
                                return -EFAULT;
                        saa->audtail += blocksize;
                        todo -= blocksize;
@@ -1868,20 +1808,22 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
                } else if (saa->writemode == VID_WRITE_MPEG_VID) {
                        spin_lock_irqsave(&saa->lock, flags);
                        if (saa->vidhead <= saa->vidtail)
-                               blocksize=524288-(saa->vidtail - saa->vidhead);
+                               blocksize = 524288 -
+                                       (saa->vidtail - saa->vidhead);
                        else
                                blocksize = saa->vidhead - saa->vidtail;
                        spin_unlock_irqrestore(&saa->lock, flags);
                        if (blocksize < 65536) {
                                saawrite(SAA7146_PSR_DEBI_S |
-                                        SAA7146_PSR_PIN1, SAA7146_IER);
+                                       SAA7146_PSR_PIN1, SAA7146_IER);
                                saawrite(SAA7146_PSR_PIN1, SAA7146_PSR);
                                /* wait for buffer space to open */
                                interruptible_sleep_on(&saa->vidq);
                        }
                        spin_lock_irqsave(&saa->lock, flags);
                        if (saa->vidhead <= saa->vidtail) {
-                               blocksize=524288-(saa->vidtail - saa->vidhead);
+                               blocksize = 524288 -
+                                       (saa->vidtail - saa->vidhead);
                                split = 524288 - saa->vidtail;
                        } else {
                                blocksize = saa->vidhead - saa->vidtail;
@@ -1896,7 +1838,7 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
                                return -ENOSPC;
                        if (split < blocksize) {
                                if (copy_from_user(saa->vidbuf +
-                                       saa->vidtail, buf, split)) 
+                                               saa->vidtail, buf, split))
                                        return -EFAULT;
                                buf += split;
                                todo -= split;
@@ -1904,7 +1846,7 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
                                saa->vidtail = 0;
                        }
                        if (copy_from_user(saa->vidbuf + saa->vidtail, buf,
-                               blocksize)) 
+                                       blocksize))
                                return -EFAULT;
                        saa->vidtail += blocksize;
                        todo -= blocksize;
@@ -1922,8 +1864,8 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
                        debiwrite(saa, debNormal, IBM_MP2_OSD_LINK_ADDR, 0, 2);
                        debiwrite(saa, debNormal, IBM_MP2_MASK0, 0xc00d, 2);
                        debiwrite(saa, debNormal, IBM_MP2_DISP_MODE,
-                                 debiread(saa, debNormal,
-                                 IBM_MP2_DISP_MODE, 2) | 1, 2);
+                               debiread(saa, debNormal,
+                                       IBM_MP2_DISP_MODE, 2) | 1, 2);
                        /* trigger osd data transfer */
                        saawrite(SAA7146_PSR_DEBI_S |
                                 SAA7146_PSR_PIN1, SAA7146_IER);
@@ -1935,21 +1877,11 @@ static ssize_t saa_write(struct file *file, const char __user *buf,
 
 static int saa_open(struct inode *inode, struct file *file)
 {
-       struct saa7146 *saa = NULL;
-       unsigned int minor = iminor(inode);
-       int i;
+       struct video_device *vdev = video_devdata(file);
+       struct saa7146 *saa = container_of(vdev, struct saa7146, video_dev);
 
-       for (i = 0; i < SAA7146_MAX; i++) {
-               if (saa7146s[i].video_dev.minor == minor) {
-                       saa = &saa7146s[i];
-               }
-       }
-       if (saa == NULL) {
-               return -ENODEV;
-       }
        file->private_data = saa;
 
-       //saa->video_dev.busy = 0; /* old hack to support multiple open */
        saa->user++;
        if (saa->user > 1)
                return 0;       /* device open already, don't reset */
@@ -1961,43 +1893,39 @@ static int saa_release(struct inode *inode, struct file *file)
 {
        struct saa7146 *saa = file->private_data;
        saa->user--;
-       //saa->video_dev.busy = 0; /* old hack to support multiple open */
+
        if (saa->user > 0)      /* still someone using device */
                return 0;
        saawrite(0x007f0000, SAA7146_MC1);      /* stop all overlay dma */
        return 0;
 }
 
-static struct file_operations saa_fops =
-{
-       .owner          = THIS_MODULE,
-       .open           = saa_open,
-       .release        = saa_release,
-       .ioctl          = saa_ioctl,
-       .compat_ioctl   = v4l_compat_ioctl32,
-       .read           = saa_read,
-       .llseek         = no_llseek,
-       .write          = saa_write,
-       .mmap           = saa_mmap,
+static struct file_operations saa_fops = {
+       .owner = THIS_MODULE,
+       .open = saa_open,
+       .release = saa_release,
+       .ioctl = saa_ioctl,
+       .compat_ioctl = v4l_compat_ioctl32,
+       .read = saa_read,
+       .llseek = no_llseek,
+       .write = saa_write,
+       .mmap = saa_mmap,
 };
 
 /* template for video_device-structure */
-static struct video_device saa_template =
-{
-       .name           = "SAA7146A",
-       .type           = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY,
-       .hardware       = VID_HARDWARE_SAA7146,
-       .fops           = &saa_fops,
-       .minor          = -1,
+static struct video_device saa_template = {
+       .name = "SAA7146A",
+       .type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY,
+       .hardware = VID_HARDWARE_SAA7146,
+       .fops = &saa_fops,
+       .minor = -1,
 };
 
-static int configure_saa7146(struct pci_dev *dev, int num)
+static int __devinit configure_saa7146(struct pci_dev *pdev, int num)
 {
-       int result;
-       struct saa7146 *saa;
+       int retval;
+       struct saa7146 *saa = pci_get_drvdata(pdev);
 
-       saa = &saa7146s[num];
-       
        saa->endmarkhead = saa->endmarktail = 0;
        saa->win.x = saa->win.y = 0;
        saa->win.width = saa->win.cropwidth = 720;
@@ -2013,7 +1941,6 @@ static int configure_saa7146(struct pci_dev *dev, int num)
        saa->picture.contrast = 38768;
        saa->picture.colour = 32768;
        saa->cap = 0;
-       saa->dev = dev;
        saa->nr = num;
        saa->playmode = VID_PLAY_NORMAL;
        memset(saa->boardcfg, 0, 64);   /* clear board config area */
@@ -2033,45 +1960,59 @@ static int configure_saa7146(struct pci_dev *dev, int num)
        init_waitqueue_head(&saa->vidq);
        spin_lock_init(&saa->lock);
 
-       if (pci_enable_device(dev))
-               return -EIO;
-       
-       saa->id = dev->device;
-       saa->irq = dev->irq;
+       retval = pci_enable_device(pdev);
+       if (retval) {
+               dev_err(&pdev->dev, "%d: pci_enable_device failed!\n", num);
+               goto err;
+       }
+
+       saa->id = pdev->device;
+       saa->irq = pdev->irq;
        saa->video_dev.minor = -1;
-       saa->saa7146_adr = pci_resource_start(dev, 0);
-       pci_read_config_byte(dev, PCI_CLASS_REVISION, &saa->revision);
+       saa->saa7146_adr = pci_resource_start(pdev, 0);
+       pci_read_config_byte(pdev, PCI_CLASS_REVISION, &saa->revision);
 
        saa->saa7146_mem = ioremap(saa->saa7146_adr, 0x200);
-       if (!saa->saa7146_mem)
-               return -EIO;
+       if (saa->saa7146_mem == NULL) {
+               dev_err(&pdev->dev, "%d: ioremap failed!\n", num);
+               retval = -EIO;
+               goto err;
+       }
 
        memcpy(&saa->video_dev, &saa_template, sizeof(saa_template));
        saawrite(0, SAA7146_IER);       /* turn off all interrupts */
-       result = request_irq(saa->irq, saa7146_irq,
-                      SA_SHIRQ | SA_INTERRUPT, "stradis", (void *) saa);
-       if (result == -EINVAL)
-               printk(KERN_ERR "stradis%d: Bad irq number or handler\n",
-                      num);
-       if (result == -EBUSY)
-               printk(KERN_ERR "stradis%d: IRQ %ld busy, change your PnP"
-                      " config in BIOS\n", num, saa->irq);
-       if (result < 0) {
-               iounmap(saa->saa7146_mem);
-               return result;
-       }
-       pci_set_master(dev);
-       if (video_register_device(&saa->video_dev, VFL_TYPE_GRABBER, video_nr) < 0) {
-               iounmap(saa->saa7146_mem);
-               return -1;
+
+       retval = request_irq(saa->irq, saa7146_irq, SA_SHIRQ | SA_INTERRUPT,
+               "stradis", saa);
+       if (retval == -EINVAL)
+               dev_err(&pdev->dev, "%d: Bad irq number or handler\n", num);
+       else if (retval == -EBUSY)
+               dev_err(&pdev->dev, "%d: IRQ %ld busy, change your PnP config "
+                       "in BIOS\n", num, saa->irq);
+       if (retval < 0)
+               goto errio;
+
+       pci_set_master(pdev);
+       retval = video_register_device(&saa->video_dev, VFL_TYPE_GRABBER,
+               video_nr);
+       if (retval < 0) {
+               dev_err(&pdev->dev, "%d: error in registering video device!\n",
+                       num);
+               goto errio;
        }
+
        return 0;
+errio:
+       iounmap(saa->saa7146_mem);
+err:
+       return retval;
 }
 
-static int init_saa7146(int i)
+static int __devinit init_saa7146(struct pci_dev *pdev)
 {
-       struct saa7146 *saa = &saa7146s[i];
+       struct saa7146 *saa = pci_get_drvdata(pdev);
 
+       memset(saa, 0, sizeof(*saa));
        saa->user = 0;
        /* reset the saa7146 */
        saawrite(0xffff0000, SAA7146_MC1);
@@ -2089,23 +2030,23 @@ static int init_saa7146(int i)
        saawrite(0x00000000, SAA7146_DD1_STREAM_A);
        saawrite(0x00000000, SAA7146_BRS_CTRL);
        saawrite(0x80400040, SAA7146_BCS_CTRL);
-       saawrite(0x0000e000 /*| (1<<29)*/, SAA7146_HPS_CTRL);
+       saawrite(0x0000e000 /*| (1<<29) */ , SAA7146_HPS_CTRL);
        saawrite(0x00000060, SAA7146_CLIP_FORMAT_CTRL);
        saawrite(0x00000000, SAA7146_ACON1);
        saawrite(0x00000000, SAA7146_ACON2);
        saawrite(0x00000600, SAA7146_I2C_STATUS);
        saawrite(((SAA7146_MC2_UPLD_D1_B | SAA7146_MC2_UPLD_D1_A |
-                  SAA7146_MC2_UPLD_BRS | SAA7146_MC2_UPLD_HPS_H |
-                  SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_DMA2 |
-          SAA7146_MC2_UPLD_DMA1 | SAA7146_MC2_UPLD_I2C) << 16) | 0xffff,
-                SAA7146_MC2);
+               SAA7146_MC2_UPLD_BRS | SAA7146_MC2_UPLD_HPS_H |
+               SAA7146_MC2_UPLD_HPS_V | SAA7146_MC2_UPLD_DMA2 |
+               SAA7146_MC2_UPLD_DMA1 | SAA7146_MC2_UPLD_I2C) << 16) | 0xffff,
+               SAA7146_MC2);
        /* setup arbitration control registers */
        saawrite(0x1412121a, SAA7146_PCI_BT_V1);
 
        /* allocate 32k dma buffer + 4k for page table */
        if ((saa->dmadebi = kmalloc(32768 + 4096, GFP_KERNEL)) == NULL) {
-               printk(KERN_ERR "stradis%d: debi kmalloc failed\n", i);
-               return -1;
+               dev_err(&pdev->dev, "%d: debi kmalloc failed\n", saa->nr);
+               goto err;
        }
 #if 0
        saa->pagedebi = saa->dmadebi + 32768;   /* top 4k is for mmu */
@@ -2115,133 +2056,162 @@ static int init_saa7146(int i)
 #endif
        saa->audhead = saa->vidhead = saa->osdhead = 0;
        saa->audtail = saa->vidtail = saa->osdtail = 0;
-       if (saa->vidbuf == NULL)
-               if ((saa->vidbuf = vmalloc(524288)) == NULL) {
-                       printk(KERN_ERR "stradis%d: malloc failed\n", saa->nr);
-                       return -ENOMEM;
-               }
-       if (saa->audbuf == NULL)
-               if ((saa->audbuf = vmalloc(65536)) == NULL) {
-                       printk(KERN_ERR "stradis%d: malloc failed\n", saa->nr);
-                       vfree(saa->vidbuf);
-                       saa->vidbuf = NULL;
-                       return -ENOMEM;
-               }
-       if (saa->osdbuf == NULL)
-               if ((saa->osdbuf = vmalloc(131072)) == NULL) {
-                       printk(KERN_ERR "stradis%d: malloc failed\n", saa->nr);
-                       vfree(saa->vidbuf);
-                       vfree(saa->audbuf);
-                       saa->vidbuf = saa->audbuf = NULL;
-                       return -ENOMEM;
-               }
+       if (saa->vidbuf == NULL && (saa->vidbuf = vmalloc(524288)) == NULL) {
+               dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr);
+               goto err;
+       }
+       if (saa->audbuf == NULL && (saa->audbuf = vmalloc(65536)) == NULL) {
+               dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr);
+               goto errvid;
+       }
+       if (saa->osdbuf == NULL && (saa->osdbuf = vmalloc(131072)) == NULL) {
+               dev_err(&pdev->dev, "%d: malloc failed\n", saa->nr);
+               goto erraud;
+       }
        /* allocate 81920 byte buffer for clipping */
-       if ((saa->dmavid2 = kmalloc(VIDEO_CLIPMAP_SIZE, GFP_KERNEL)) == NULL) {
-               printk(KERN_ERR "stradis%d: clip kmalloc failed\n", saa->nr);
-               vfree(saa->vidbuf);
-               vfree(saa->audbuf);
-               vfree(saa->osdbuf);
-               saa->vidbuf = saa->audbuf = saa->osdbuf = NULL;
-               saa->dmavid2 = NULL;
-               return -1;
+       if ((saa->dmavid2 = kzalloc(VIDEO_CLIPMAP_SIZE, GFP_KERNEL)) == NULL) {
+               dev_err(&pdev->dev, "%d: clip kmalloc failed\n", saa->nr);
+               goto errosd;
        }
-       memset(saa->dmavid2, 0x00, VIDEO_CLIPMAP_SIZE); /* clip everything */
        /* setup clipping registers */
        saawrite(virt_to_bus(saa->dmavid2), SAA7146_BASE_EVEN2);
        saawrite(virt_to_bus(saa->dmavid2) + 128, SAA7146_BASE_ODD2);
        saawrite(virt_to_bus(saa->dmavid2) + VIDEO_CLIPMAP_SIZE,
-               SAA7146_PROT_ADDR2);
+                SAA7146_PROT_ADDR2);
        saawrite(256, SAA7146_PITCH2);
-       saawrite(4, SAA7146_PAGE2); /* dma direction: read, no byteswap */
+       saawrite(4, SAA7146_PAGE2);     /* dma direction: read, no byteswap */
        saawrite(((SAA7146_MC2_UPLD_DMA2) << 16) | SAA7146_MC2_UPLD_DMA2,
                 SAA7146_MC2);
        I2CBusScan(saa);
+
        return 0;
+errosd:
+       vfree(saa->osdbuf);
+       saa->osdbuf = NULL;
+erraud:
+       vfree(saa->audbuf);
+       saa->audbuf = NULL;
+errvid:
+       vfree(saa->vidbuf);
+       saa->vidbuf = NULL;
+err:
+       return -ENOMEM;
 }
 
-static void release_saa(void)
+static void stradis_release_saa(struct pci_dev *pdev)
 {
        u8 command;
-       int i;
-       struct saa7146 *saa;
+       struct saa7146 *saa = pci_get_drvdata(pdev);
 
-       for (i = 0; i < saa_num; i++) {
-               saa = &saa7146s[i];
+       /* turn off all capturing, DMA and IRQs */
+       saawrite(0xffff0000, SAA7146_MC1);      /* reset chip */
+       saawrite(0, SAA7146_MC2);
+       saawrite(0, SAA7146_IER);
+       saawrite(0xffffffffUL, SAA7146_ISR);
+
+       /* disable PCI bus-mastering */
+       pci_read_config_byte(pdev, PCI_COMMAND, &command);
+       command &= ~PCI_COMMAND_MASTER;
+       pci_write_config_byte(pdev, PCI_COMMAND, command);
+
+       /* unmap and free memory */
+       saa->audhead = saa->audtail = saa->osdhead = 0;
+       saa->vidhead = saa->vidtail = saa->osdtail = 0;
+       vfree(saa->vidbuf);
+       vfree(saa->audbuf);
+       vfree(saa->osdbuf);
+       kfree(saa->dmavid2);
+       saa->audbuf = saa->vidbuf = saa->osdbuf = NULL;
+       saa->dmavid2 = NULL;
+       kfree(saa->dmadebi);
+       kfree(saa->dmavid1);
+       kfree(saa->dmavid3);
+       kfree(saa->dmaa1in);
+       kfree(saa->dmaa1out);
+       kfree(saa->dmaa2in);
+       kfree(saa->dmaa2out);
+       kfree(saa->dmaRPS1);
+       kfree(saa->dmaRPS2);
+       free_irq(saa->irq, saa);
+       if (saa->saa7146_mem)
+               iounmap(saa->saa7146_mem);
+       if (saa->video_dev.minor != -1)
+               video_unregister_device(&saa->video_dev);
+}
 
-               /* turn off all capturing, DMA and IRQs */
-               saawrite(0xffff0000, SAA7146_MC1);      /* reset chip */
-               saawrite(0, SAA7146_MC2);
-               saawrite(0, SAA7146_IER);
-               saawrite(0xffffffffUL, SAA7146_ISR);
-
-               /* disable PCI bus-mastering */
-               pci_read_config_byte(saa->dev, PCI_COMMAND, &command);
-               command &= ~PCI_COMMAND_MASTER;
-               pci_write_config_byte(saa->dev, PCI_COMMAND, command);
-
-               /* unmap and free memory */
-               saa->audhead = saa->audtail = saa->osdhead = 0;
-               saa->vidhead = saa->vidtail = saa->osdtail = 0;
-               vfree(saa->vidbuf);
-               vfree(saa->audbuf);
-               vfree(saa->osdbuf);
-               kfree(saa->dmavid2);
-               saa->audbuf = saa->vidbuf = saa->osdbuf = NULL;
-               saa->dmavid2 = NULL;
-               kfree(saa->dmadebi);
-               kfree(saa->dmavid1);
-               kfree(saa->dmavid3);
-               kfree(saa->dmaa1in);
-               kfree(saa->dmaa1out);
-               kfree(saa->dmaa2in);
-               kfree(saa->dmaa2out);
-               kfree(saa->dmaRPS1);
-               kfree(saa->dmaRPS2);
-               free_irq(saa->irq, saa);
-               if (saa->saa7146_mem)
-                       iounmap(saa->saa7146_mem);
-               if (saa->video_dev.minor != -1)
-                       video_unregister_device(&saa->video_dev);
+static int __devinit stradis_probe(struct pci_dev *pdev,
+       const struct pci_device_id *ent)
+{
+       int retval = -EINVAL;
+
+       if (saa_num >= SAA7146_MAX)
+               goto err;
+
+       if (!pdev->subsystem_vendor)
+               dev_info(&pdev->dev, "%d: rev1 decoder\n", saa_num);
+       else
+               dev_info(&pdev->dev, "%d: SDM2xx found\n", saa_num);
+
+       pci_set_drvdata(pdev, &saa7146s[saa_num]);
+
+       retval = configure_saa7146(pdev, saa_num);
+       if (retval) {
+               dev_err(&pdev->dev, "%d: error in configuring\n", saa_num);
+               goto err;
+       }
+
+       if (init_saa7146(pdev) < 0) {
+               dev_err(&pdev->dev, "%d: error in initialization\n", saa_num);
+               retval = -EIO;
+               goto errrel;
        }
+
+       saa_num++;
+
+       return 0;
+errrel:
+       stradis_release_saa(pdev);
+err:
+       return retval;
+}
+
+static void __devexit stradis_remove(struct pci_dev *pdev)
+{
+       stradis_release_saa(pdev);
 }
 
+static struct pci_device_id stradis_pci_tbl[] = {
+       { PCI_DEVICE(PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146) },
+       { 0 }
+};
+
+MODULE_DEVICE_TABLE(pci, stradis_pci_tbl);
+
+static struct pci_driver stradis_driver = {
+       .name = "stradis",
+       .id_table = stradis_pci_tbl,
+       .probe = stradis_probe,
+       .remove = __devexit_p(stradis_remove)
+};
 
-static int __init stradis_init (void)
+int __init stradis_init(void)
 {
-       struct pci_dev *dev = NULL;
-       int result = 0, i;
+       int retval;
 
        saa_num = 0;
 
-       while ((dev = pci_find_device(PCI_VENDOR_ID_PHILIPS, PCI_DEVICE_ID_PHILIPS_SAA7146, dev))) {
-               if (!dev->subsystem_vendor)
-                       printk(KERN_INFO "stradis%d: rev1 decoder\n", saa_num);
-               else
-                       printk(KERN_INFO "stradis%d: SDM2xx found\n", saa_num); 
-               result = configure_saa7146(dev, saa_num++);
-               if (result)
-                       return result;
-       }
-       if (saa_num)
-               printk(KERN_INFO "stradis: %d card(s) found.\n", saa_num);
-       else
-               return -EINVAL;
-       for (i = 0; i < saa_num; i++)
-               if (init_saa7146(i) < 0) {
-                       release_saa();
-                       return -EIO;
-               }
-       return 0;
-}
+       retval = pci_register_driver(&stradis_driver);
+       if (retval)
+               printk(KERN_ERR "stradis: Unable to register pci driver.\n");
 
+       return retval;
+}
 
-static void __exit stradis_exit (void)
+void __exit stradis_exit(void)
 {
-       release_saa();
+       pci_unregister_driver(&stradis_driver);
        printk(KERN_INFO "stradis: module cleanup complete\n");
 }
 
-
 module_init(stradis_init);
 module_exit(stradis_exit);
-
index 99261f15e66ebebdb15a3ea9921ff1029188d291..fc3d5824efffd330a828e64d04c5e58460ed118e 100644 (file)
@@ -227,8 +227,8 @@ static struct i2c_client client_template;
 static int tda7432_write(struct i2c_client *client, int subaddr, int val)
 {
        unsigned char buffer[2];
-       v4l_dbg(2,client,"In tda7432_write\n");
-       v4l_dbg(1,client,"Writing %d 0x%x\n", subaddr, val);
+       v4l_dbg(2, debug,client,"In tda7432_write\n");
+       v4l_dbg(1, debug,client,"Writing %d 0x%x\n", subaddr, val);
        buffer[0] = subaddr;
        buffer[1] = val;
        if (2 != i2c_master_send(client,buffer,2)) {
@@ -245,9 +245,9 @@ static int tda7432_set(struct i2c_client *client)
 {
        struct tda7432 *t = i2c_get_clientdata(client);
        unsigned char buf[16];
-       v4l_dbg(2,client,"In tda7432_set\n");
+       v4l_dbg(2, debug,client,"In tda7432_set\n");
 
-       v4l_dbg(1,client,
+       v4l_dbg(1, debug,client,
                "tda7432: 7432_set(0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x)\n",
                t->input,t->volume,t->bass,t->treble,t->lf,t->lr,t->rf,t->rr,t->loud);
        buf[0]  = TDA7432_IN;
@@ -271,7 +271,7 @@ static int tda7432_set(struct i2c_client *client)
 static void do_tda7432_init(struct i2c_client *client)
 {
        struct tda7432 *t = i2c_get_clientdata(client);
-       v4l_dbg(2,client,"In tda7432_init\n");
+       v4l_dbg(2, debug,client,"In tda7432_init\n");
 
        t->input  = TDA7432_STEREO_IN |  /* Main (stereo) input   */
                    TDA7432_BASS_SYM  |  /* Symmetric bass cut    */
@@ -300,10 +300,9 @@ static int tda7432_attach(struct i2c_adapter *adap, int addr, int kind)
        struct tda7432 *t;
        struct i2c_client *client;
 
-       t = kmalloc(sizeof *t,GFP_KERNEL);
+       t = kzalloc(sizeof *t,GFP_KERNEL);
        if (!t)
                return -ENOMEM;
-       memset(t,0,sizeof *t);
 
        client = &t->c;
        memcpy(client,&client_template,sizeof(struct i2c_client));
@@ -340,7 +339,7 @@ static int tda7432_command(struct i2c_client *client,
                           unsigned int cmd, void *arg)
 {
        struct tda7432 *t = i2c_get_clientdata(client);
-       v4l_dbg(2,client,"In tda7432_command\n");
+       v4l_dbg(2, debug,client,"In tda7432_command\n");
        if (debug>1)
                v4l_i2c_print_ioctl(client,cmd);
 
index 299393bf900a38c7fd67754a8845a8be102f070e..ef98c49822507f63d5ffbf710890541cdc8c2e6c 100644 (file)
@@ -232,10 +232,9 @@ static int tda9875_attach(struct i2c_adapter *adap, int addr, int kind)
        struct i2c_client *client;
        dprintk("In tda9875_attach\n");
 
-       t = kmalloc(sizeof *t,GFP_KERNEL);
+       t = kzalloc(sizeof *t,GFP_KERNEL);
        if (!t)
                return -ENOMEM;
-       memset(t,0,sizeof *t);
 
        client = &t->c;
        memcpy(client,&client_template,sizeof(struct i2c_client));
index 9cf47dc65579c28acc2b9fcf4224593884484745..5815649bdc78e316f3fd40c655530909a3986321 100644 (file)
@@ -696,9 +696,8 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind)
        client_template.adapter = adap;
        client_template.addr    = addr;
 
-       if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL)))
+       if (NULL == (t = kzalloc(sizeof(*t), GFP_KERNEL)))
                return -ENOMEM;
-       memset(t,0,sizeof(*t));
 
        t->client      = client_template;
        t->std         = 0;
index 261b7a3c041735ce88337db628495c2c0c485526..921fe72f23d5f2bacdf7cf4a0e2e7a9b0cc8e33e 100644 (file)
@@ -18,7 +18,7 @@
 #define PREFIX "TEA5767 "
 
 /* from tuner-core.c */
-extern int debug;
+extern int tuner_debug;
 
 /*****************************************************************************/
 
@@ -249,7 +249,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
        if (5 != (rc = i2c_master_send(c, buffer, 5)))
                tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
 
-       if (debug) {
+       if (tuner_debug) {
                if (5 != (rc = i2c_master_recv(c, buffer, 5)))
                        tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
                else
index c4ba3742f5c779eceb2fef90545791dbc9d1988a..4dcba5a4fff099d95a19b61391c4925e6df47f92 100644 (file)
@@ -99,11 +99,10 @@ static int tea6420_detect(struct i2c_adapter *adapter, int address, int kind)
        }
 
        /* allocate memory for client structure */
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (0 == client) {
                return -ENOMEM;
        }
-       memset(client, 0x0, sizeof(struct i2c_client));
 
        /* fill client structure */
        memcpy(client, &client_template, sizeof(struct i2c_client));
index d97f66804c3745362fb97dd70da3392a539a5fcf..c4a78e7a5a58bf3206ccae4f69ee9d7ba3d98580 100644 (file)
@@ -193,8 +193,7 @@ static struct i2c_client client_template =
 static int __init
 tuner3036_init(void)
 {
-       i2c_add_driver(&i2c_driver_tuner);
-       return 0;
+       return i2c_add_driver(&i2c_driver_tuner);
 }
 
 static void __exit
index 57bc585a6955c135dfad3c37fefd0f4eaf58c79c..f30ef79d795e1cc98af82d3422fe0612f9559fb4 100644 (file)
@@ -41,8 +41,8 @@ static unsigned int no_autodetect = 0;
 static unsigned int show_i2c = 0;
 
 /* insmod options used at runtime => read/write */
-static unsigned int tuner_debug = 0;
-int debug = 0;
+static unsigned int tuner_debug_old = 0;
+int tuner_debug = 0;
 
 static unsigned int tv_range[2] = { 44, 958 };
 static unsigned int radio_range[2] = { 65, 108 };
@@ -51,13 +51,13 @@ static char pal[] = "--";
 static char secam[] = "--";
 static char ntsc[] = "-";
 
+
 module_param(addr, int, 0444);
 module_param(no_autodetect, int, 0444);
 module_param(show_i2c, int, 0444);
 /* Note: tuner_debug is deprecated and will be removed in 2.6.17 */
-module_param(tuner_debug, int, 0444);
-module_param(debug, int, 0644);
-
+module_param_named(tuner_debug,tuner_debug_old, int, 0444);
+module_param_named(debug,tuner_debug, int, 0644);
 module_param_string(pal, pal, sizeof(pal), 0644);
 module_param_string(secam, secam, sizeof(secam), 0644);
 module_param_string(ntsc, ntsc, sizeof(ntsc), 0644);
@@ -410,18 +410,17 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
        client_template.adapter = adap;
        client_template.addr = addr;
 
-       t = kmalloc(sizeof(struct tuner), GFP_KERNEL);
+       t = kzalloc(sizeof(struct tuner), GFP_KERNEL);
        if (NULL == t)
                return -ENOMEM;
-       memset(t, 0, sizeof(struct tuner));
        memcpy(&t->i2c, &client_template, sizeof(struct i2c_client));
        i2c_set_clientdata(&t->i2c, t);
        t->type = UNSET;
        t->radio_if2 = 10700 * 1000;    /* 10.7MHz - FM radio */
        t->audmode = V4L2_TUNER_MODE_STEREO;
        t->mode_mask = T_UNINITIALIZED;
-       if (tuner_debug) {
-               debug = tuner_debug;
+       if (tuner_debug_old) {
+               tuner_debug = tuner_debug_old;
                printk(KERN_ERR "tuner: tuner_debug is deprecated and will be removed in 2.6.17.\n");
                printk(KERN_ERR "tuner: use the debug option instead.\n");
        }
@@ -552,7 +551,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
 {
        struct tuner *t = i2c_get_clientdata(client);
 
-       if (debug>1)
+       if (tuner_debug>1)
                v4l_i2c_print_ioctl(&(t->i2c),cmd);
 
        switch (cmd) {
index b582943a0d3e57406f9d3ed1434c20f26586b873..6d03b9b05c6ec6b334b52c172eaec7b9ee5429f7 100644 (file)
@@ -159,7 +159,7 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
        unsigned char buffer[2];
 
        if (-1 == subaddr) {
-               v4l_dbg(1, &chip->c, "%s: chip_write: 0x%x\n",
+               v4l_dbg(1, debug, &chip->c, "%s: chip_write: 0x%x\n",
                        chip->c.name, val);
                chip->shadow.bytes[1] = val;
                buffer[0] = val;
@@ -169,7 +169,7 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
                        return -1;
                }
        } else {
-               v4l_dbg(1, &chip->c, "%s: chip_write: reg%d=0x%x\n",
+               v4l_dbg(1, debug, &chip->c, "%s: chip_write: reg%d=0x%x\n",
                        chip->c.name, subaddr, val);
                chip->shadow.bytes[subaddr+1] = val;
                buffer[0] = subaddr;
@@ -204,7 +204,7 @@ static int chip_read(struct CHIPSTATE *chip)
                chip->c.name);
                return -1;
        }
-       v4l_dbg(1, &chip->c, "%s: chip_read: 0x%x\n",chip->c.name, buffer);
+       v4l_dbg(1, debug, &chip->c, "%s: chip_read: 0x%x\n",chip->c.name, buffer);
        return buffer;
 }
 
@@ -222,7 +222,7 @@ static int chip_read2(struct CHIPSTATE *chip, int subaddr)
                v4l_warn(&chip->c, "%s: I/O error (read2)\n", chip->c.name);
                return -1;
        }
-       v4l_dbg(1, &chip->c, "%s: chip_read2: reg%d=0x%x\n",
+       v4l_dbg(1, debug, &chip->c, "%s: chip_read2: reg%d=0x%x\n",
                chip->c.name, subaddr,read[0]);
        return read[0];
 }
@@ -235,7 +235,7 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd)
                return 0;
 
        /* update our shadow register set; print bytes if (debug > 0) */
-       v4l_dbg(1, &chip->c, "%s: chip_cmd(%s): reg=%d, data:",
+       v4l_dbg(1, debug, &chip->c, "%s: chip_cmd(%s): reg=%d, data:",
                chip->c.name, name,cmd->bytes[0]);
        for (i = 1; i < cmd->count; i++) {
                if (debug)
@@ -274,7 +274,7 @@ static int chip_thread(void *data)
 
        daemonize("%s", chip->c.name);
        allow_signal(SIGTERM);
-       v4l_dbg(1, &chip->c, "%s: thread started\n", chip->c.name);
+       v4l_dbg(1, debug, &chip->c, "%s: thread started\n", chip->c.name);
 
        for (;;) {
                add_wait_queue(&chip->wq, &wait);
@@ -286,7 +286,7 @@ static int chip_thread(void *data)
                try_to_freeze();
                if (chip->done || signal_pending(current))
                        break;
-               v4l_dbg(1, &chip->c, "%s: thread wakeup\n", chip->c.name);
+               v4l_dbg(1, debug, &chip->c, "%s: thread wakeup\n", chip->c.name);
 
                /* don't do anything for radio or if mode != auto */
                if (chip->radio || chip->mode != 0)
@@ -299,7 +299,7 @@ static int chip_thread(void *data)
                mod_timer(&chip->wt, jiffies+2*HZ);
        }
 
-       v4l_dbg(1, &chip->c, "%s: thread exiting\n", chip->c.name);
+       v4l_dbg(1, debug, &chip->c, "%s: thread exiting\n", chip->c.name);
        complete_and_exit(&chip->texit, 0);
        return 0;
 }
@@ -312,7 +312,7 @@ static void generic_checkmode(struct CHIPSTATE *chip)
        if (mode == chip->prevmode)
        return;
 
-       v4l_dbg(1, &chip->c, "%s: thread checkmode\n", chip->c.name);
+       v4l_dbg(1, debug, &chip->c, "%s: thread checkmode\n", chip->c.name);
        chip->prevmode = mode;
 
        if (mode & VIDEO_SOUND_STEREO)
@@ -359,7 +359,7 @@ static int tda9840_getmode(struct CHIPSTATE *chip)
        if (val & TDA9840_ST_STEREO)
                mode |= VIDEO_SOUND_STEREO;
 
-       v4l_dbg(1, &chip->c, "tda9840_getmode(): raw chip read: %d, return: %d\n",
+       v4l_dbg(1, debug, &chip->c, "tda9840_getmode(): raw chip read: %d, return: %d\n",
                val, mode);
        return mode;
 }
@@ -655,7 +655,7 @@ static int tda9873_getmode(struct CHIPSTATE *chip)
                mode |= VIDEO_SOUND_STEREO;
        if (val & TDA9873_DUAL)
                mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
-       v4l_dbg(1, &chip->c, "tda9873_getmode(): raw chip read: %d, return: %d\n",
+       v4l_dbg(1, debug, &chip->c, "tda9873_getmode(): raw chip read: %d, return: %d\n",
                val, mode);
        return mode;
 }
@@ -666,12 +666,12 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode)
        /*      int adj_data = chip->shadow.bytes[TDA9873_AD+1] ; */
 
        if ((sw_data & TDA9873_INP_MASK) != TDA9873_INTERNAL) {
-               v4l_dbg(1, &chip->c, "tda9873_setmode(): external input\n");
+               v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): external input\n");
                return;
        }
 
-       v4l_dbg(1, &chip->c, "tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]);
-       v4l_dbg(1, &chip->c, "tda9873_setmode(): sw_data  = %d\n", sw_data);
+       v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]);
+       v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): sw_data  = %d\n", sw_data);
 
        switch (mode) {
        case VIDEO_SOUND_MONO:
@@ -692,7 +692,7 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode)
        }
 
        chip_write(chip, TDA9873_SW, sw_data);
-       v4l_dbg(1, &chip->c, "tda9873_setmode(): req. mode %d; chip_write: %d\n",
+       v4l_dbg(1, debug, &chip->c, "tda9873_setmode(): req. mode %d; chip_write: %d\n",
                mode, sw_data);
 }
 
@@ -831,7 +831,7 @@ static int tda9874a_setup(struct CHIPSTATE *chip)
                chip_write(chip, TDA9874A_SDACOSR, (tda9874a_mode) ? 0x81:0x80);
                chip_write(chip, TDA9874A_AOSR, 0x00); /* or 0x10 */
        }
-       v4l_dbg(1, &chip->c, "tda9874a_setup(): %s [0x%02X].\n",
+       v4l_dbg(1, debug, &chip->c, "tda9874a_setup(): %s [0x%02X].\n",
                tda9874a_modelist[tda9874a_STD].name,tda9874a_STD);
        return 1;
 }
@@ -874,7 +874,7 @@ static int tda9874a_getmode(struct CHIPSTATE *chip)
                        mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
        }
 
-       v4l_dbg(1, &chip->c, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n",
+       v4l_dbg(1, debug, &chip->c, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n",
                 dsr, nsr, necr, mode);
        return mode;
 }
@@ -920,7 +920,7 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode)
                chip_write(chip, TDA9874A_AOSR, aosr);
                chip_write(chip, TDA9874A_MDACOSR, mdacosr);
 
-               v4l_dbg(1, &chip->c, "tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n",
+               v4l_dbg(1, debug, &chip->c, "tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n",
                        mode, aosr, mdacosr);
 
        } else { /* dic == 0x07 */
@@ -955,7 +955,7 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode)
                chip_write(chip, TDA9874A_FMMR, fmmr);
                chip_write(chip, TDA9874A_AOSR, aosr);
 
-               v4l_dbg(1, &chip->c, "tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n",
+               v4l_dbg(1, debug, &chip->c, "tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n",
                        mode, fmmr, aosr);
        }
 }
@@ -969,7 +969,7 @@ static int tda9874a_checkit(struct CHIPSTATE *chip)
        if(-1 == (sic = chip_read2(chip,TDA9874A_SIC)))
                return 0;
 
-       v4l_dbg(1, &chip->c, "tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic);
+       v4l_dbg(1, debug, &chip->c, "tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic);
 
        if((dic == 0x11)||(dic == 0x07)) {
                v4l_info(&chip->c, "found tda9874%s.\n", (dic == 0x11) ? "a":"h");
@@ -1184,7 +1184,7 @@ static int ta8874z_getmode(struct CHIPSTATE *chip)
        }else if (!(val & TA8874Z_B0)){
                mode |= VIDEO_SOUND_STEREO;
        }
-       /* v4l_dbg(1, &chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */
+       /* v4l_dbg(1, debug, &chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */
        return mode;
 }
 
@@ -1197,7 +1197,7 @@ static void ta8874z_setmode(struct CHIPSTATE *chip, int mode)
 {
        int update = 1;
        audiocmd *t = NULL;
-       v4l_dbg(1, &chip->c, "ta8874z_setmode(): mode: 0x%02x\n", mode);
+       v4l_dbg(1, debug, &chip->c, "ta8874z_setmode(): mode: 0x%02x\n", mode);
 
        switch(mode){
        case VIDEO_SOUND_MONO:
@@ -1468,17 +1468,16 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
        struct CHIPSTATE *chip;
        struct CHIPDESC  *desc;
 
-       chip = kmalloc(sizeof(*chip),GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip),GFP_KERNEL);
        if (!chip)
                return -ENOMEM;
-       memset(chip,0,sizeof(*chip));
        memcpy(&chip->c,&client_template,sizeof(struct i2c_client));
        chip->c.adapter = adap;
        chip->c.addr = addr;
        i2c_set_clientdata(&chip->c, chip);
 
        /* find description for the chip */
-       v4l_dbg(1, &chip->c, "chip found @ 0x%x\n", addr<<1);
+       v4l_dbg(1, debug, &chip->c, "chip found @ 0x%x\n", addr<<1);
        for (desc = chiplist; desc->name != NULL; desc++) {
                if (0 == *(desc->insmodopt))
                        continue;
@@ -1490,12 +1489,12 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
                break;
        }
        if (desc->name == NULL) {
-               v4l_dbg(1, &chip->c, "no matching chip description found\n");
+               v4l_dbg(1, debug, &chip->c, "no matching chip description found\n");
                return -EIO;
        }
        v4l_info(&chip->c, "%s found @ 0x%x (%s)\n", desc->name, addr<<1, adap->name);
        if (desc->flags) {
-               v4l_dbg(1, &chip->c, "matches:%s%s%s.\n",
+               v4l_dbg(1, debug, &chip->c, "matches:%s%s%s.\n",
                        (desc->flags & CHIP_HAS_VOLUME)     ? " volume"      : "",
                        (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "",
                        (desc->flags & CHIP_HAS_INPUTSEL)   ? " audiomux"    : "");
@@ -1583,7 +1582,7 @@ static int chip_command(struct i2c_client *client,
        struct CHIPSTATE *chip = i2c_get_clientdata(client);
        struct CHIPDESC  *desc = chiplist + chip->type;
 
-       v4l_dbg(1, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd);
+       v4l_dbg(1, debug, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd);
 
        switch (cmd) {
        case AUDC_SET_INPUT:
index fd0acc5da66771e5c5af5aa73bff79537ea3ea30..5e71a354e879464b6d3d99fc324be2d6512e0778 100644 (file)
@@ -719,8 +719,7 @@ tveeprom_command(struct i2c_client *client,
 
        switch (cmd) {
        case 0:
-               buf = kmalloc(256,GFP_KERNEL);
-               memset(buf,0,256);
+               buf = kzalloc(256,GFP_KERNEL);
                tveeprom_read(client,buf,256);
                tveeprom_hauppauge_analog(client, &eeprom,buf);
                kfree(buf);
@@ -743,10 +742,9 @@ tveeprom_detect_client(struct i2c_adapter *adapter,
 {
        struct i2c_client *client;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (NULL == client)
                return -ENOMEM;
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver_tveeprom;
index c35b8042eee58dd84bd7080a28801762bb36c4c9..e86b522938fdad9a09cc7fe78194e1b84e499683 100644 (file)
@@ -1074,12 +1074,11 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter,
                return -ENOMEM;
        memcpy(c, &client_template, sizeof(struct i2c_client));
 
-       core = kmalloc(sizeof(struct tvp5150), GFP_KERNEL);
+       core = kzalloc(sizeof(struct tvp5150), GFP_KERNEL);
        if (core == 0) {
                kfree(c);
                return -ENOMEM;
        }
-       memset(core, 0, sizeof(struct tvp5150));
        i2c_set_clientdata(c, core);
 
        rv = i2c_attach_client(c);
index 2ab5b4093800bc789c992e067e8bc21b9e54f442..474a29bc1760d9feedc2bf8beb6b7d8907666783 100644 (file)
@@ -305,9 +305,8 @@ v4l_compat_translate_ioctl(struct inode         *inode,
        {
                struct video_capability *cap = arg;
 
-               cap2 = kmalloc(sizeof(*cap2),GFP_KERNEL);
+               cap2 = kzalloc(sizeof(*cap2),GFP_KERNEL);
                memset(cap, 0, sizeof(*cap));
-               memset(cap2, 0, sizeof(*cap2));
                memset(&fbuf2, 0, sizeof(fbuf2));
 
                err = drv(inode, file, VIDIOC_QUERYCAP, cap2);
@@ -422,9 +421,8 @@ v4l_compat_translate_ioctl(struct inode         *inode,
        {
                struct video_window     *win = arg;
 
-               fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
                memset(win,0,sizeof(*win));
-               memset(fmt2,0,sizeof(*fmt2));
 
                fmt2->type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
                err = drv(inode, file, VIDIOC_G_FMT, fmt2);
@@ -461,8 +459,7 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                struct video_window     *win = arg;
                int err1,err2;
 
-               fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
-               memset(fmt2,0,sizeof(*fmt2));
+               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
                fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                drv(inode, file, VIDIOC_STREAMOFF, &fmt2->type);
                err1 = drv(inode, file, VIDIOC_G_FMT, fmt2);
@@ -595,8 +592,7 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                pict->whiteness = get_v4l_control(inode, file,
                                                  V4L2_CID_WHITENESS, drv);
 
-               fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
-               memset(fmt2,0,sizeof(*fmt2));
+               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
                fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                err = drv(inode, file, VIDIOC_G_FMT, fmt2);
                if (err < 0) {
@@ -622,8 +618,7 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                set_v4l_control(inode, file,
                                V4L2_CID_WHITENESS, pict->whiteness, drv);
 
-               fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
-               memset(fmt2,0,sizeof(*fmt2));
+               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
                fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                err = drv(inode, file, VIDIOC_G_FMT, fmt2);
                if (err < 0)
@@ -846,9 +841,8 @@ v4l_compat_translate_ioctl(struct inode         *inode,
        {
                struct video_mmap       *mm = arg;
 
-               fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
+               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
                memset(&buf2,0,sizeof(buf2));
-               memset(fmt2,0,sizeof(*fmt2));
 
                fmt2->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
                err = drv(inode, file, VIDIOC_G_FMT, fmt2);
@@ -942,8 +936,7 @@ v4l_compat_translate_ioctl(struct inode         *inode,
        {
                struct vbi_format      *fmt = arg;
 
-               fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
-               memset(fmt2, 0, sizeof(*fmt2));
+               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
                fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE;
 
                err = drv(inode, file, VIDIOC_G_FMT, fmt2);
@@ -975,8 +968,7 @@ v4l_compat_translate_ioctl(struct inode         *inode,
                        break;
                }
 
-               fmt2 = kmalloc(sizeof(*fmt2),GFP_KERNEL);
-               memset(fmt2, 0, sizeof(*fmt2));
+               fmt2 = kzalloc(sizeof(*fmt2),GFP_KERNEL);
 
                fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE;
                fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line;
index 9a6bf287e26ae629497aa0e9c3c206281e817a41..9ef477523d27ecba4789ed4607bcb959ec335440 100644 (file)
@@ -52,10 +52,9 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages)
        struct page *pg;
        int i;
 
-       sglist = kmalloc(sizeof(struct scatterlist)*nr_pages, GFP_KERNEL);
+       sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL);
        if (NULL == sglist)
                return NULL;
-       memset(sglist,0,sizeof(struct scatterlist)*nr_pages);
        for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
                pg = vmalloc_to_page(virt);
                if (NULL == pg)
@@ -80,10 +79,9 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
 
        if (NULL == pages[0])
                return NULL;
-       sglist = kmalloc(sizeof(*sglist) * nr_pages, GFP_KERNEL);
+       sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL);
        if (NULL == sglist)
                return NULL;
-       memset(sglist, 0, sizeof(*sglist) * nr_pages);
 
        if (NULL == pages[0])
                goto nopage;
@@ -284,9 +282,8 @@ void* videobuf_alloc(unsigned int size)
 {
        struct videobuf_buffer *vb;
 
-       vb = kmalloc(size,GFP_KERNEL);
+       vb = kzalloc(size,GFP_KERNEL);
        if (NULL != vb) {
-               memset(vb,0,size);
                videobuf_dma_init(&vb->dma);
                init_waitqueue_head(&vb->done);
                vb->magic     = MAGIC_BUFFER;
index 839db622040dcdcfe1ff344d7f8846b5c9a7ef53..8f271de57fd6c8e0fe246b49cf692e6f02d4b510 100644 (file)
@@ -124,17 +124,13 @@ videocodec_attach (struct videocodec_master *master)
                        if (res == 0) {
                                dprintk(3, "videocodec_attach '%s'\n",
                                        codec->name);
-                               ptr = (struct attached_list *)
-                                   kmalloc(sizeof(struct attached_list),
-                                           GFP_KERNEL);
+                               ptr = kzalloc(sizeof(struct attached_list), GFP_KERNEL);
                                if (!ptr) {
                                        dprintk(1,
                                                KERN_ERR
                                                "videocodec_attach: no memory\n");
                                        goto out_kfree;
                                }
-                               memset(ptr, 0,
-                                      sizeof(struct attached_list));
                                ptr->codec = codec;
 
                                a = h->list;
@@ -249,14 +245,11 @@ videocodec_register (const struct videocodec *codec)
                "videocodec: register '%s', type: %x, flags %lx, magic %lx\n",
                codec->name, codec->type, codec->flags, codec->magic);
 
-       ptr =
-           (struct codec_list *) kmalloc(sizeof(struct codec_list),
-                                         GFP_KERNEL);
+       ptr = kzalloc(sizeof(struct codec_list), GFP_KERNEL);
        if (!ptr) {
                dprintk(1, KERN_ERR "videocodec_register: no memory\n");
                return -ENOMEM;
        }
-       memset(ptr, 0, sizeof(struct codec_list));
        ptr->codec = codec;
 
        if (!h) {
index 9a9902c56ae72f81d06ebf58088baf73e05cc28a..d5be25987142c65eb891bacbdae3d55b74fe08bc 100644 (file)
@@ -52,10 +52,7 @@ struct video_device *video_device_alloc(void)
 {
        struct video_device *vfd;
 
-       vfd = kmalloc(sizeof(*vfd),GFP_KERNEL);
-       if (NULL == vfd)
-               return NULL;
-       memset(vfd,0,sizeof(*vfd));
+       vfd = kzalloc(sizeof(*vfd),GFP_KERNEL);
        return vfd;
 }
 
index 71b28e9e085021e1fdae979e4edf7fe6b270a353..c8fd8238904dbaef113c6f550dcc2396549d3c26 100644 (file)
@@ -4499,13 +4499,11 @@ static int vino_init(void)
        dma_addr_t dma_dummy_address;
        int i;
 
-       vino_drvdata = (struct vino_settings *)
-               kmalloc(sizeof(struct vino_settings), GFP_KERNEL);
+       vino_drvdata = kzalloc(sizeof(struct vino_settings), GFP_KERNEL);
        if (!vino_drvdata) {
                vino_module_cleanup(vino_init_stage);
                return -ENOMEM;
        }
-       memset(vino_drvdata, 0, sizeof(struct vino_settings));
        vino_init_stage++;
 
        /* create a dummy dma descriptor */
index 8dcee8b60e21a2cfc458808b1bbf13376d814a7b..d0a1e72ea8c46924482141d1ad2dc64b30570c78 100644 (file)
@@ -621,13 +621,11 @@ vpx3220_detect_client (struct i2c_adapter *adapter,
            (adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == NULL) {
                return -ENOMEM;
        }
 
-       memset(client, 0, sizeof(struct i2c_client));
-
        client->addr = address;
        client->adapter = adapter;
        client->driver = &vpx3220_i2c_driver;
@@ -675,12 +673,11 @@ vpx3220_detect_client (struct i2c_adapter *adapter,
                        sizeof(I2C_NAME(client)));
        }
 
-       decoder = kmalloc(sizeof(struct vpx3220), GFP_KERNEL);
+       decoder = kzalloc(sizeof(struct vpx3220), GFP_KERNEL);
        if (decoder == NULL) {
                kfree(client);
                return -ENOMEM;
        }
-       memset(decoder, 0, sizeof(struct vpx3220));
        decoder->norm = VIDEO_MODE_PAL;
        decoder->input = 0;
        decoder->enable = 1;
index c2e6d2e9f5f12ad70bcd52c6421debeef62dda25..8cb64f8a8a9182b8e5f9a146c8d4f3fba8d9381d 100644 (file)
@@ -166,11 +166,10 @@ static int wm8775_attach(struct i2c_adapter *adapter, int address, int kind)
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return 0;
 
-       client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+       client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
        if (client == 0)
                return -ENOMEM;
 
-       memset(client, 0, sizeof(struct i2c_client));
        client->addr = address;
        client->adapter = adapter;
        client->driver = &i2c_driver;
index 39a0d238900e63f26c34992944b73a441e66b8f4..ea3288661a3457d65a49b2d841514c18674760e8 100644 (file)
@@ -1050,7 +1050,7 @@ zr36057_init (struct zoran *zr)
        /* allocate memory *before* doing anything to the hardware
         * in case allocation fails */
        mem_needed = BUZ_NUM_STAT_COM * 4;
-       mem = (unsigned long) kmalloc(mem_needed, GFP_KERNEL);
+       mem = kzalloc(mem_needed, GFP_KERNEL);
        vdev = (void *) kmalloc(sizeof(struct video_device), GFP_KERNEL);
        if (!mem || !vdev) {
                dprintk(1,
@@ -1061,7 +1061,6 @@ zr36057_init (struct zoran *zr)
                kfree((void *)mem);
                return -ENOMEM;
        }
-       memset((void *) mem, 0, mem_needed);
        zr->stat_com = (u32 *) mem;
        for (j = 0; j < BUZ_NUM_STAT_COM; j++) {
                zr->stat_com[j] = 1;    /* mark as unavailable to zr36057 */
index 15283f44e79f6b56ba6bd708f8710ed9779156aa..485553be190be7cd764ba6081d8427b97c5df15b 100644 (file)
@@ -1345,7 +1345,7 @@ zoran_open (struct inode *inode,
                ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
 
        /* now, create the open()-specific file_ops struct */
-       fh = kmalloc(sizeof(struct zoran_fh), GFP_KERNEL);
+       fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL);
        if (!fh) {
                dprintk(1,
                        KERN_ERR
@@ -1354,7 +1354,6 @@ zoran_open (struct inode *inode,
                res = -ENOMEM;
                goto open_unlock_and_return;
        }
-       memset(fh, 0, sizeof(struct zoran_fh));
        /* used to be BUZ_MAX_WIDTH/HEIGHT, but that gives overflows
         * on norm-change! */
        fh->overlay_mask =
index 4ed898585c7082234aaec06bfd6e6150dd2068d4..10130ef67ea7f644d736c0d3daa45c88254f8b4c 100644 (file)
@@ -451,12 +451,11 @@ zr36016_setup (struct videocodec *codec)
                return -ENOSPC;
        }
        //mem structure init
-       codec->data = ptr = kmalloc(sizeof(struct zr36016), GFP_KERNEL);
+       codec->data = ptr = kzalloc(sizeof(struct zr36016), GFP_KERNEL);
        if (NULL == ptr) {
                dprintk(1, KERN_ERR "zr36016: Can't get enough memory!\n");
                return -ENOMEM;
        }
-       memset(ptr, 0, sizeof(struct zr36016));
 
        snprintf(ptr->name, sizeof(ptr->name), "zr36016[%d]",
                 zr36016_codecs);
index 0144576a61233d239e7bf35f1f0811418b8ed6b7..bd0cd28543ca02f7f007c4abff113f9792d8149a 100644 (file)
@@ -813,12 +813,11 @@ zr36050_setup (struct videocodec *codec)
                return -ENOSPC;
        }
        //mem structure init
-       codec->data = ptr = kmalloc(sizeof(struct zr36050), GFP_KERNEL);
+       codec->data = ptr = kzalloc(sizeof(struct zr36050), GFP_KERNEL);
        if (NULL == ptr) {
                dprintk(1, KERN_ERR "zr36050: Can't get enough memory!\n");
                return -ENOMEM;
        }
-       memset(ptr, 0, sizeof(struct zr36050));
 
        snprintf(ptr->name, sizeof(ptr->name), "zr36050[%d]",
                 zr36050_codecs);
index 129744a07abd868c47609ad23adda80c42f8e82e..28fa31a5f1501a2afcc2989085b6fd3b372d76cd 100644 (file)
@@ -919,12 +919,11 @@ zr36060_setup (struct videocodec *codec)
                return -ENOSPC;
        }
        //mem structure init
-       codec->data = ptr = kmalloc(sizeof(struct zr36060), GFP_KERNEL);
+       codec->data = ptr = kzalloc(sizeof(struct zr36060), GFP_KERNEL);
        if (NULL == ptr) {
                dprintk(1, KERN_ERR "zr36060: Can't get enough memory!\n");
                return -ENOMEM;
        }
-       memset(ptr, 0, sizeof(struct zr36060));
 
        snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]",
                 zr36060_codecs);
index ef47edc1508182474737f781ee587c396c584c00..5c15f3e9ea0723e4ce472bf0b55edd3af3849109 100644 (file)
@@ -1397,7 +1397,7 @@ config CS89x0
 
          To compile this driver as a module, choose M here and read
          <file:Documentation/networking/net-modules.txt>.  The module will be
-         called cs89x.
+         called cs89x0.
 
 config TC35815
        tristate "TOSHIBA TC35815 Ethernet support"
index 907c0100974665b57e80c695f357e3d02f78cd04..e2cfde7e31eca8bf1736187909fbb4832286a66a 100644 (file)
  * Note that even if DMA is turned off we still support the 'dma' and  'use_dma'
  * module options so we don't break any startup scripts.
  */
-#ifndef CONFIG_ARCH_IXDP2X01
+#ifndef CONFIG_ISA_DMA_API
 #define ALLOW_DMA      0
 #else
 #define ALLOW_DMA      1
index 08703d6f934c7926e8ed1c53a9c45b3ec1a5dd47..d8410634bcafc078ad4da1f6979fe1577a842b81 100644 (file)
@@ -150,7 +150,7 @@ static void __init hplance_init(struct net_device *dev, struct dio_dev *d)
         lp->lance.name = (char*)d->name;                /* discards const, shut up gcc */
         lp->lance.base = va;
         lp->lance.init_block = (struct lance_init_block *)(va + HPLANCE_MEMOFF); /* CPU addr */
-        lp->lance.lance_init_block = 0;                 /* LANCE addr of same RAM */
+        lp->lance.lance_init_block = NULL;              /* LANCE addr of same RAM */
         lp->lance.busmaster_regval = LE_C3_BSWP;        /* we're bigendian */
         lp->lance.irq = d->ipl;
         lp->lance.writerap = hplance_writerap;
index d8c99f038fa0a7ce07400af7ef8352126b9167be..06cb460361a81432160cdaa841bcaad316184350 100644 (file)
@@ -559,55 +559,52 @@ static void mac8390_no_reset(struct net_device *dev)
 /* directly from daynaport.c by Alan Cox */
 static void dayna_memcpy_fromcard(struct net_device *dev, void *to, int from, int count)
 {
-       volatile unsigned short *ptr;
-       unsigned short *target=to;
+       volatile unsigned char *ptr;
+       unsigned char *target=to;
        from<<=1;       /* word, skip overhead */
-       ptr=(unsigned short *)(dev->mem_start+from);
+       ptr=(unsigned char *)(dev->mem_start+from);
        /* Leading byte? */
        if (from&2) {
-               *((char *)target)++ = *(((char *)ptr++)-1);
+               *target++ = ptr[-1];
+               ptr += 2;
                count--;
        }
        while(count>=2)
        {
-               *target++=*ptr++;       /* Copy and */
-               ptr++;                  /* skip cruft */
+               *(unsigned short *)target = *(unsigned short volatile *)ptr;
+               ptr += 4;                       /* skip cruft */
+               target += 2;
                count-=2;
        }
        /* Trailing byte? */
        if(count)
-       {
-               /* Big endian */
-               unsigned short v=*ptr;
-               *((char *)target)=v>>8;
-       }
+               *target = *ptr;
 }
 
 static void dayna_memcpy_tocard(struct net_device *dev, int to, const void *from, int count)
 {
        volatile unsigned short *ptr;
-       const unsigned short *src=from;
+       const unsigned char *src=from;
        to<<=1; /* word, skip overhead */
        ptr=(unsigned short *)(dev->mem_start+to);
        /* Leading byte? */
        if (to&2) { /* avoid a byte write (stomps on other data) */
-               ptr[-1] = (ptr[-1]&0xFF00)|*((unsigned char *)src)++;
+               ptr[-1] = (ptr[-1]&0xFF00)|*src++;
                ptr++;
                count--;
        }
        while(count>=2)
        {
-               *ptr++=*src++;          /* Copy and */
+               *ptr++=*(unsigned short *)src;          /* Copy and */
                ptr++;                  /* skip cruft */
+               src += 2;
                count-=2;
        }
        /* Trailing byte? */
        if(count)
        {
-               /* Big endian */
-               unsigned short v=*src;
                /* card doesn't like byte writes */
-               *ptr=(*ptr&0x00FF)|(v&0xFF00);
+               *ptr=(*ptr&0x00FF)|(*src << 8);
        }
 }
 
index 5c8fcd40ef4d29936fad6828d3fda9d9df58ffcd..01bdb23340584bf6576d9a63b90f5a92645110df 100644 (file)
@@ -389,7 +389,7 @@ static int __init lance_probe( struct net_device *dev)
        dev->stop = &lance_close;
        dev->get_stats = &lance_get_stats;
        dev->set_multicast_list = &set_multicast_list;
-       dev->set_mac_address = 0;
+       dev->set_mac_address = NULL;
 //     KLUDGE -- REMOVE ME
        set_bit(__LINK_STATE_PRESENT, &dev->state);
 
index 166bca79013348284662eddb6ea6b31022ea2964..b80318f0342022fe53827cae6e242a66479d761b 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/vmalloc.h>
 #include <linux/oprofile.h>
 #include <linux/sched.h>
+#include <linux/capability.h>
 #include <linux/dcookies.h>
 #include <linux/fs.h>
 #include <asm/uaccess.h>
index f357d3f6036072069a3734215e1d3931236a421e..3627a2d7f79feb3b701dceba05312e8079cbe002 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/types.h>
 #include <linux/ioport.h>
 #include <linux/utsname.h>
+#include <linux/capability.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/inetdevice.h>
index 38bdca2fac6beaacafd8090b27a292c31eec770e..42a3c54e8e6ccb6d4a29983c313ecc6d078af2e8 100644 (file)
@@ -42,9 +42,9 @@
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/sched.h>               /* for capable() */
 #include <linux/kernel.h>
 #include <linux/string.h>
+#include <linux/capability.h>
 #include <linux/ctype.h>
 #include <linux/sysfs.h>
 #include <linux/kobject.h>
index f062ea0f813a189d688fc6cfe21ab70e0f3b4c4f..6e0c059df6a5339da1349164aa59cb46ae5733a8 100644 (file)
@@ -45,7 +45,7 @@ obj-$(CONFIG_CYBERSTORMII_SCSI)       += NCR53C9x.o   cyberstormII.o
 obj-$(CONFIG_BLZ2060_SCSI)     += NCR53C9x.o   blz2060.o
 obj-$(CONFIG_BLZ1230_SCSI)     += NCR53C9x.o   blz1230.o
 obj-$(CONFIG_FASTLANE_SCSI)    += NCR53C9x.o   fastlane.o
-obj-$(CONFIG_OKTAGON_SCSI)     += NCR53C9x.o   oktagon_esp.o   oktagon_io.o
+obj-$(CONFIG_OKTAGON_SCSI)     += NCR53C9x.o   oktagon_esp_mod.o
 obj-$(CONFIG_ATARI_SCSI)       += atari_scsi.o
 obj-$(CONFIG_MAC_SCSI)         += mac_scsi.o
 obj-$(CONFIG_SCSI_MAC_ESP)     += mac_esp.o    NCR53C9x.o
@@ -164,6 +164,7 @@ CFLAGS_ncr53c8xx.o  := $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m)
 zalon7xx-objs  := zalon.o ncr53c8xx.o
 NCR_Q720_mod-objs      := NCR_Q720.o ncr53c8xx.o
 libata-objs    := libata-core.o libata-scsi.o
+oktagon_esp_mod-objs   := oktagon_esp.o oktagon_io.o
 
 # Files generated that shall be removed upon make clean
 clean-files := 53c7xx_d.h 53c700_d.h   \
index 640590bd014a10c5c1f98c3974bc42be58e447e4..c7dd0154d012b10bdeb5fc4d51a855955e0b61ac 100644 (file)
@@ -1799,6 +1799,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
                 */
                int oldphase, i = 0; /* or where we left off last time ?? esp->current_data ?? */
                int fifocnt = 0;
+               unsigned char *p = phys_to_virt((unsigned long)SCptr->SCp.ptr);
 
                oldphase = esp_read(eregs->esp_status) & ESP_STAT_PMASK;
 
@@ -1860,7 +1861,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
 
                                /* read fifo */
                                for(j=0;j<fifocnt;j++)
-                                       SCptr->SCp.ptr[i++] = esp_read(eregs->esp_fdata);
+                                       p[i++] = esp_read(eregs->esp_fdata);
 
                                ESPDATA(("(%d) ", i));
 
@@ -1882,7 +1883,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
 
                                /* fill fifo */
                                for(j=0;j<this_count;j++)
-                                       esp_write(eregs->esp_fdata, SCptr->SCp.ptr[i++]);
+                                       esp_write(eregs->esp_fdata, p[i++]);
 
                                /* how many left if this goes out ?? */
                                hmuch -= this_count;
index 763e409a1ff37b96684cc9ecd2d6d6a2d17befc6..3867ac2de4c22666790c18c91fba03b3d76d6eb7 100644 (file)
@@ -224,7 +224,7 @@ static int dma_can_transfer(struct NCR_ESP *esp, Scsi_Cmnd *sp)
 static void dma_dump_state(struct NCR_ESP *esp)
 {
        ESPLOG(("intreq:<%04x>, intena:<%04x>\n",
-               custom.intreqr, custom.intenar));
+               amiga_custom.intreqr, amiga_custom.intenar));
 }
 
 void dma_init_read(struct NCR_ESP *esp, __u32 addr, int length)
@@ -298,7 +298,7 @@ static int dma_irq_p(struct NCR_ESP *esp)
 
 static int dma_ports_p(struct NCR_ESP *esp)
 {
-       return ((custom.intenar) & IF_PORTS);
+       return ((amiga_custom.intenar) & IF_PORTS);
 }
 
 static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write)
index d72d05fffdfa45747c4abe68d5a3e757ea08a5fb..4ebe69e3275696bf8ae25fd4878f05089c13ec57 100644 (file)
@@ -190,7 +190,7 @@ static int dma_can_transfer(struct NCR_ESP *esp, Scsi_Cmnd *sp)
 static void dma_dump_state(struct NCR_ESP *esp)
 {
        ESPLOG(("intreq:<%04x>, intena:<%04x>\n",
-               custom.intreqr, custom.intenar));
+               amiga_custom.intreqr, amiga_custom.intenar));
 }
 
 static void dma_init_read(struct NCR_ESP *esp, __u32 addr, int length)
@@ -251,7 +251,7 @@ static void dma_led_on(struct NCR_ESP *esp)
 
 static int dma_ports_p(struct NCR_ESP *esp)
 {
-       return ((custom.intenar) & IF_PORTS);
+       return ((amiga_custom.intenar) & IF_PORTS);
 }
 
 static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write)
index f9b940e56430c432760edc06e53613417f349bc5..a4a4fac5c0a11454473f53bf26056e40ef43c8dd 100644 (file)
@@ -223,7 +223,7 @@ static void dma_dump_state(struct NCR_ESP *esp)
                esp->esp_id, ((struct cyber_dma_registers *)
                              (esp->dregs))->cond_reg));
        ESPLOG(("intreq:<%04x>, intena:<%04x>\n",
-               custom.intreqr, custom.intenar));
+               amiga_custom.intreqr, amiga_custom.intenar));
 }
 
 static void dma_init_read(struct NCR_ESP *esp, __u32 addr, int length)
@@ -322,7 +322,7 @@ static void dma_led_on(struct NCR_ESP *esp)
 
 static int dma_ports_p(struct NCR_ESP *esp)
 {
-       return ((custom.intenar) & IF_PORTS);
+       return ((amiga_custom.intenar) & IF_PORTS);
 }
 
 static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write)
index a3caabfd7557ff08e5234b0eea90536970a09b37..3a803d73bc5fa46591c792d59de0edeea7b15de7 100644 (file)
@@ -200,7 +200,7 @@ static void dma_dump_state(struct NCR_ESP *esp)
                esp->esp_id, ((struct cyberII_dma_registers *)
                              (esp->dregs))->cond_reg));
        ESPLOG(("intreq:<%04x>, intena:<%04x>\n",
-               custom.intreqr, custom.intenar));
+               amiga_custom.intreqr, amiga_custom.intenar));
 }
 
 static void dma_init_read(struct NCR_ESP *esp, __u32 addr, int length)
@@ -259,7 +259,7 @@ static void dma_led_on(struct NCR_ESP *esp)
 
 static int dma_ports_p(struct NCR_ESP *esp)
 {
-       return ((custom.intenar) & IF_PORTS);
+       return ((amiga_custom.intenar) & IF_PORTS);
 }
 
 static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write)
index ccee68b52f7e8dc53c20cb53c6c87db9e06cbc13..8ae9c406a83b4d1727756af596feec9408f8a11f 100644 (file)
@@ -268,7 +268,7 @@ static void dma_dump_state(struct NCR_ESP *esp)
                esp->esp_id, ((struct fastlane_dma_registers *)
                              (esp->dregs))->cond_reg));
        ESPLOG(("intreq:<%04x>, intena:<%04x>\n",
-               custom.intreqr, custom.intenar));
+               amiga_custom.intreqr, amiga_custom.intenar));
 }
 
 static void dma_init_read(struct NCR_ESP *esp, __u32 addr, int length)
@@ -368,7 +368,7 @@ static void dma_led_on(struct NCR_ESP *esp)
 
 static int dma_ports_p(struct NCR_ESP *esp)
 {
-       return ((custom.intenar) & IF_PORTS);
+       return ((amiga_custom.intenar) & IF_PORTS);
 }
 
 static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write)
index 5d9c9ada814f16c653e062530d717168283734d2..dee426f8c07b566bd8fdbdf148483b40e4f09e06 100644 (file)
@@ -490,7 +490,7 @@ static void dma_led_on(struct NCR_ESP *esp)
 
 static int dma_ports_p(struct NCR_ESP *esp)
 {
-       return ((custom.intenar) & IF_PORTS);
+       return ((amiga_custom.intenar) & IF_PORTS);
 }
 
 static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write)
index fd63add6a577aba8ab03c1389e0ef7497ffc789f..fb53eeaee617b62fc453058879b795ea729859ac 100644 (file)
@@ -465,7 +465,7 @@ wd33c93_execute(struct Scsi_Host *instance)
         */
 
        cmd = (struct scsi_cmnd *) hostdata->input_Q;
-       prev = 0;
+       prev = NULL;
        while (cmd) {
                if (!(hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)))
                        break;
@@ -1569,7 +1569,7 @@ wd33c93_abort(struct scsi_cmnd * cmd)
  */
 
        tmp = (struct scsi_cmnd *) hostdata->input_Q;
-       prev = 0;
+       prev = NULL;
        while (tmp) {
                if (tmp == cmd) {
                        if (prev)
index d549e215f3c57fe944c39583baa6718d9554ee1b..2c42a812655a14a977e963a7aeb7bb0898afec01 100644 (file)
@@ -590,6 +590,8 @@ static u_short maxfmode, chipset;
 #define highw(x)       ((u_long)(x)>>16 & 0xffff)
 #define loww(x)                ((u_long)(x) & 0xffff)
 
+#define custom         amiga_custom
+
 #define VBlankOn()     custom.intena = IF_SETCLR|IF_COPER
 #define VBlankOff()    custom.intena = IF_COPER
 
@@ -1164,8 +1166,8 @@ static void ami_update_display(void);
 static void ami_init_display(void);
 static void ami_do_blank(void);
 static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix);
-static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data);
-static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data);
+static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data);
+static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data);
 static int ami_get_cursorstate(struct fb_cursorstate *state);
 static int ami_set_cursorstate(struct fb_cursorstate *state);
 static void ami_set_sprite(void);
@@ -2179,6 +2181,7 @@ static int amifb_ioctl(struct inode *inode, struct file *file,
                struct fb_var_cursorinfo var;
                struct fb_cursorstate state;
        } crsr;
+       void __user *argp = (void __user *)arg;
        int i;
 
        switch (cmd) {
@@ -2186,33 +2189,32 @@ static int amifb_ioctl(struct inode *inode, struct file *file,
                        i = ami_get_fix_cursorinfo(&crsr.fix);
                        if (i)
                                return i;
-                       return copy_to_user((void *)arg, &crsr.fix,
+                       return copy_to_user(argp, &crsr.fix,
                                            sizeof(crsr.fix)) ? -EFAULT : 0;
 
                case FBIOGET_VCURSORINFO:
                        i = ami_get_var_cursorinfo(&crsr.var,
-                               ((struct fb_var_cursorinfo *)arg)->data);
+                               ((struct fb_var_cursorinfo __user *)arg)->data);
                        if (i)
                                return i;
-                       return copy_to_user((void *)arg, &crsr.var,
+                       return copy_to_user(argp, &crsr.var,
                                            sizeof(crsr.var)) ? -EFAULT : 0;
 
                case FBIOPUT_VCURSORINFO:
-                       if (copy_from_user(&crsr.var, (void *)arg,
-                                          sizeof(crsr.var)))
+                       if (copy_from_user(&crsr.var, argp, sizeof(crsr.var)))
                                return -EFAULT;
                        return ami_set_var_cursorinfo(&crsr.var,
-                               ((struct fb_var_cursorinfo *)arg)->data);
+                               ((struct fb_var_cursorinfo __user *)arg)->data);
 
                case FBIOGET_CURSORSTATE:
                        i = ami_get_cursorstate(&crsr.state);
                        if (i)
                                return i;
-                       return copy_to_user((void *)arg, &crsr.state,
+                       return copy_to_user(argp, &crsr.state,
                                            sizeof(crsr.state)) ? -EFAULT : 0;
 
                case FBIOPUT_CURSORSTATE:
-                       if (copy_from_user(&crsr.state, (void *)arg,
+                       if (copy_from_user(&crsr.state, argp,
                                           sizeof(crsr.state)))
                                return -EFAULT;
                        return ami_set_cursorstate(&crsr.state);
@@ -3325,7 +3327,7 @@ static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix)
        return 0;
 }
 
-static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data)
+static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data)
 {
        struct amifb_par *par = &currentpar;
        register u_short *lspr, *sspr;
@@ -3347,14 +3349,14 @@ static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data)
        var->yspot = par->crsr.spot_y;
        if (size > var->height*var->width)
                return -ENAMETOOLONG;
-       if (!access_ok(VERIFY_WRITE, (void *)data, size))
+       if (!access_ok(VERIFY_WRITE, data, size))
                return -EFAULT;
        delta = 1<<par->crsr.fmode;
        lspr = lofsprite + (delta<<1);
        if (par->bplcon0 & BPC0_LACE)
                sspr = shfsprite + (delta<<1);
        else
-               sspr = 0;
+               sspr = NULL;
        for (height = (short)var->height-1; height >= 0; height--) {
                bits = 0; words = delta; datawords = 0;
                for (width = (short)var->width-1; width >= 0; width--) {
@@ -3400,7 +3402,7 @@ static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data)
        return 0;
 }
 
-static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data)
+static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data)
 {
        struct amifb_par *par = &currentpar;
        register u_short *lspr, *sspr;
@@ -3427,7 +3429,7 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data)
                return -EINVAL;
        if (!var->height)
                return -EINVAL;
-       if (!access_ok(VERIFY_READ, (void *)data, var->width*var->height))
+       if (!access_ok(VERIFY_READ, data, var->width*var->height))
                return -EFAULT;
        delta = 1<<fmode;
        lofsprite = shfsprite = (u_short *)spritememory;
@@ -3442,13 +3444,13 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data)
                if (((var->height+2)<<fmode<<2) > SPRITEMEMSIZE)
                        return -EINVAL;
                memset(lspr, 0, (var->height+2)<<fmode<<2);
-               sspr = 0;
+               sspr = NULL;
        }
        for (height = (short)var->height-1; height >= 0; height--) {
                bits = 16; words = delta; datawords = 0;
                for (width = (short)var->width-1; width >= 0; width--) {
                        unsigned long tdata = 0;
-                       get_user(tdata, (char *)data);
+                       get_user(tdata, data);
                        data++;
 #ifdef __mc68000__
                        asm volatile (
index e370125e4fbc8ebe5a1cf192544d902bdda1e2a6..ed81005cbdba51cdf2fd06c318083fa063cb839c 100644 (file)
@@ -3501,7 +3501,7 @@ err_release_mem:
 
 static int __devinit atyfb_atari_probe(void)
 {
-       struct aty_par *par;
+       struct atyfb_par *par;
        struct fb_info *info;
        int m64_num;
        u32 clock_r;
index cfc748e9427260037a075a0ad78ebdc8e90c4560..e6cbd9de944acdaa0ab28f9bc88a76263289fd11 100644 (file)
@@ -609,18 +609,19 @@ void __init macfb_setup(char *options)
        }
 }
 
-void __init macfb_init(void)
+static int __init macfb_init(void)
 {
        int video_cmap_len, video_is_nubus = 0;
        struct nubus_dev* ndev = NULL;
        char *option = NULL;
+       int err;
 
        if (fb_get_options("macfb", &option))
                return -ENODEV;
        macfb_setup(option);
 
        if (!MACH_IS_MAC) 
-               return;
+               return -ENODEV;
 
        /* There can only be one internal video controller anyway so
           we're not too worried about this */
@@ -958,11 +959,11 @@ void __init macfb_init(void)
 
        fb_alloc_cmap(&fb_info.cmap, video_cmap_len, 0);
        
-       if (register_framebuffer(&fb_info) < 0)
-               return;
-
-       printk("fb%d: %s frame buffer device\n",
-              fb_info.node, fb_info.fix.id);
+       err = register_framebuffer(&fb_info);
+       if (!err)
+               printk("fb%d: %s frame buffer device\n",
+                      fb_info.node, fb_info.fix.id);
+       return err;
 }
 
 module_init(macfb_init);
index 1a409c2c320c800fef3935dd54bbf4d717036e15..7aa2d3de6d37d3378a96378c520c2ac5fef276a2 100644 (file)
@@ -45,7 +45,7 @@ proc_bus_zorro_lseek(struct file *file, loff_t off, int whence)
 }
 
 static ssize_t
-proc_bus_zorro_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos)
+proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 {
        struct inode *ino = file->f_dentry->d_inode;
        struct proc_dir_entry *dp = PDE(ino);
index d63e5096f2f2f235fd90cf7337515a3a715e041f..97de946708781df074388be1da5e4f811872766a 100644 (file)
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -10,6 +10,7 @@
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/smp_lock.h>
+#include <linux/capability.h>
 #include <linux/fsnotify.h>
 #include <linux/fcntl.h>
 #include <linux/quotaops.h>
index 808134a5a2fa63896bc4349415f478aaf440d1ad..870e2cf3301653030bb9cf29512c163f8e172398 100644 (file)
@@ -10,6 +10,7 @@
  *
  * ------------------------------------------------------------------------- */
 
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/stat.h>
 #include <linux/param.h>
index 14aa70282e8ca8feb20875cfbe86485386f556d8..e93a7ae467c996644a189d5b73d4d538459dd758 100644 (file)
@@ -12,6 +12,7 @@
  *
  * ------------------------------------------------------------------------- */
 
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/stat.h>
 #include <linux/param.h>
index 6466bc8a3dc7069522d821bb8325fea75823492e..b9bb7ad6897b90456332813bc15615741171c9c8 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/percpu.h>
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
+#include <linux/capability.h>
 #include <linux/blkdev.h>
 #include <linux/file.h>
 #include <linux/quotaops.h>
index 890bc30fbe2003563e4dbd52559decd06d724c23..5dd0207ffd46607f947aadb9b1c7c1d8e5e39890 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 #include <linux/compat.h>
 #include <linux/kernel.h>
+#include <linux/capability.h>
 #include <linux/compiler.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
 #include <linux/dvb/dmx.h>
 #include <linux/dvb/frontend.h>
 #include <linux/dvb/video.h>
+#include <linux/lp.h>
 
 /* Aiee. Someone does not find a difference between int and long */
 #define EXT2_IOC32_GETFLAGS               _IOR('f', 1, int)
@@ -915,6 +917,40 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
        return err;
 }
 
+struct compat_sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
+       char req_state;
+       char orphan;
+       char sg_io_owned;
+       char problem;
+       int pack_id;
+       compat_uptr_t usr_ptr;
+       unsigned int duration;
+       int unused;
+};
+
+static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+       int err, i;
+       sg_req_info_t *r;
+       struct compat_sg_req_info *o = (struct compat_sg_req_info *)arg;
+       r = compat_alloc_user_space(sizeof(sg_req_info_t)*SG_MAX_QUEUE);
+       err = sys_ioctl(fd,cmd,(unsigned long)r);
+       if (err < 0)
+               return err;
+       for (i = 0; i < SG_MAX_QUEUE; i++) {
+               void __user *ptr;
+               int d;
+
+               if (copy_in_user(o + i, r + i, offsetof(sg_req_info_t, usr_ptr)) ||
+                   get_user(ptr, &r[i].usr_ptr) ||
+                   get_user(d, &r[i].duration) ||
+                   put_user((u32)(unsigned long)(ptr), &o[i].usr_ptr) ||
+                   put_user(d, &o[i].duration))
+                       return -EFAULT;
+       }
+       return err;
+}
+
 struct sock_fprog32 {
        unsigned short  len;
        compat_caddr_t  filter;
@@ -2700,6 +2736,20 @@ static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned lon
 }
 #endif
 
+static int
+lp_timeout_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+       struct compat_timeval *tc = (struct compat_timeval *)arg;
+       struct timeval *tn = compat_alloc_user_space(sizeof(struct timeval));
+       struct timeval ts;
+       if (get_user(ts.tv_sec, &tc->tv_sec) ||
+           get_user(ts.tv_usec, &tc->tv_usec) ||
+           put_user(ts.tv_sec, &tn->tv_sec) ||
+           put_user(ts.tv_usec, &tn->tv_usec))
+               return -EFAULT;
+       return sys_ioctl(fd, cmd, (unsigned long)tn);
+}
+
 #define HANDLE_IOCTL(cmd,handler) \
        { (cmd), (ioctl_trans_handler_t)(handler) },
 
@@ -2793,6 +2843,7 @@ HANDLE_IOCTL(FDPOLLDRVSTAT32, fd_ioctl_trans)
 HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans)
 HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans)
 HANDLE_IOCTL(SG_IO,sg_ioctl_trans)
+HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans)
 HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans)
 HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans)
 HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans)
@@ -2926,6 +2977,20 @@ HANDLE_IOCTL(DMX_GET_EVENT, do_dmx_get_event)
 HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event)
 HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture)
 HANDLE_IOCTL(VIDEO_SET_SPU_PALETTE, do_video_set_spu_palette)
+
+/* parport */
+COMPATIBLE_IOCTL(LPTIME)
+COMPATIBLE_IOCTL(LPCHAR)
+COMPATIBLE_IOCTL(LPABORTOPEN)
+COMPATIBLE_IOCTL(LPCAREFUL)
+COMPATIBLE_IOCTL(LPWAIT)
+COMPATIBLE_IOCTL(LPSETIRQ)
+COMPATIBLE_IOCTL(LPGETSTATUS)
+COMPATIBLE_IOCTL(LPGETSTATUS)
+COMPATIBLE_IOCTL(LPRESET)
+/*LPGETSTATS not implemented, but no kernels seem to compile it in anyways*/
+COMPATIBLE_IOCTL(LPGETFLAGS)
+HANDLE_IOCTL(LPSETTIMEOUT, lp_timeout_trans)
 };
 
 int ioctl_table_size = ARRAY_SIZE(ioctl_start);
index 02aa0ddc582a6a169fe855883cf069923e63bb74..f8274a8f83bd1a7c7051749c7a2de689369fb850 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/list.h>
 #include <linux/mount.h>
+#include <linux/capability.h>
 #include <linux/dcache.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
index cb6d5bfbdfd5157a96a9af7a6137b37880190151..1966c890b48d1df00e04bc09e612ade805ad77f6 100644 (file)
@@ -77,6 +77,7 @@
 #include <linux/kmod.h>
 #include <linux/namei.h>
 #include <linux/buffer_head.h>
+#include <linux/capability.h>
 #include <linux/quotaops.h>
 
 #include <asm/uaccess.h>
index 239133d01d91aa7fad26b676c232af53331408da..35acc43b897f7e46b1563b2fa696973dec67ebe7 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de>
  */
 
+#include <linux/capability.h>
 #include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
index bb6908066494e5dd158894b15232700f062fc8c4..2c00953d4b0b909b483f05f94b33da7f893c3acf 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/quotaops.h>
 #include <linux/sched.h>
 #include <linux/buffer_head.h>
+#include <linux/capability.h>
 
 /*
  * balloc.c contains the blocks allocation and deallocation routines
index 709d8676b962b3505de210db2d446d4f3d1ba408..3ca9afdf713d579d92f2037cc5ee4f69db9ab3da 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "ext2.h"
+#include <linux/capability.h>
 #include <linux/time.h>
 #include <linux/sched.h>
 #include <asm/current.h>
index 2c072bfea23ba9a5f55049ab410b62fc529badd5..f28a6a499c9650bb6d612947d9b78ff7650151db 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/module.h>
 #include <linux/string.h>
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/smp_lock.h>
 #include <linux/ext2_fs.h>
index 9ed132c960348da2227cbab44b02dc15530a932d..47a9da2dfb4fbd9739ab46531fca3ec2d5040c9d 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/ext3_jbd.h>
 #include <linux/ext3_fs.h>
index c6393fb4c35a476997e6938e3afacfd105a489a0..6250fcdf14a14ee2ca772046c666464901ffaab6 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <linux/config.h>
 #include <linux/time.h>
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/jbd.h>
 #include <linux/ext3_fs.h>
index 706d686083814393d942f86eebf7530c0313f85d..556cd5510078a5e83e3c9490ae4439fb41605c06 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/fs.h>
 #include <linux/jbd.h>
+#include <linux/capability.h>
 #include <linux/ext3_fs.h>
 #include <linux/ext3_jbd.h>
 #include <linux/time.h>
index 7c693c94f14d8eb7e070e2bc74ad1ce4a92e7bcc..86d91f1186dce11da40650e0c716cfc2214cbb6d 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/module.h>
 #include <linux/string.h>
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/smp_lock.h>
 #include <linux/ext3_jbd.h>
index d30876cf35f56c31fcbb8275a24095e7909520f0..e99c5a73b39e6f172e52ee394cba5b9289a78e87 100644 (file)
@@ -6,6 +6,7 @@
  *  regular file handling primitives for fat-based filesystems
  */
 
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/time.h>
 #include <linux/msdos_fs.h>
index 9903bde475f2ec4877bd0f0f32e76b2939ebf81f..d0767fe5836247dd68aac8d7f3bd5818984e2790 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/mm.h>
 #include <linux/fs.h>
 #include <linux/file.h>
+#include <linux/capability.h>
 #include <linux/dnotify.h>
 #include <linux/smp_lock.h>
 #include <linux/slab.h>
index 6142250104a6dbdc2acd0a5eca5ad7263105785b..768b581675433ed0e02eb0a9bcf35288de7adca5 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/eventpoll.h>
 #include <linux/rcupdate.h>
 #include <linux/mount.h>
+#include <linux/capability.h>
 #include <linux/cdev.h>
 #include <linux/fsnotify.h>
 
index e07aa096e07c3a221d39167b46c673d81a121d96..13cf848ac8330ef03ebfbce82e3ce3ba07d5bc2c 100644 (file)
@@ -12,6 +12,7 @@
  * hfsplus ioctls
  */
 
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/sched.h>
 #include <linux/xattr.h>
index ff1b7d108bd021f7ebe1dbcaac5aa6569e4aeee9..ab4c3a9d51b88948650d345378934fe912c8c440 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/highmem.h>
 #include <linux/init.h>
 #include <linux/string.h>
+#include <linux/capability.h>
 #include <linux/backing-dev.h>
 #include <linux/hugetlb.h>
 #include <linux/pagevec.h>
index 569209181425d20f5860c80b3a6dbfb92db4919b..f8aeec3ca10c20985146e292023e5554b2290765 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/syscalls.h>
 #include <linux/mm.h>
 #include <linux/smp_lock.h>
+#include <linux/capability.h>
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/security.h>
index 4bf1c6365a19d2ce3d9ae52da457026792528f40..ca77008146c02494018bf84c28b370f0e0a6b39a 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/kernel.h>
 #include <linux/ioprio.h>
 #include <linux/blkdev.h>
+#include <linux/capability.h>
 #include <linux/syscalls.h>
 
 static int set_task_ioprio(struct task_struct *task, int ioprio)
index d0fcc5f3497ed1e757f6b420b78d3ba7193c3c3d..09e5d10b88401ca736bbd70d099d847fd9698bed 100644 (file)
@@ -11,6 +11,7 @@
  *
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 952da5f917cdc7ad4133ccc1a8cf46e5bd94ec14..f23048f9471f0c921c1e2514f91c9ff5afb5fd97 100644 (file)
@@ -17,6 +17,7 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/xattr.h>
 #include <linux/posix_acl_xattr.h>
index 0a8f073435af7c1bc9bee409f58dc44d8e9308b3..1e5746eb13809777ca97c5cb4db2fc778008c30c 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/syscalls.h>
 #include <linux/mount.h>
 #include <linux/audit.h>
+#include <linux/capability.h>
 #include <linux/file.h>
 #include <asm/namei.h>
 #include <asm/uaccess.h>
index 2ca6145f43d6b047a4b98eabab9e1ccfd447ba81..8bc15b362d239f211ca0e28a1054df9b2094804c 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/init.h>
 #include <linux/quotaops.h>
 #include <linux/acct.h>
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/seq_file.h>
 #include <linux/namespace.h>
index fd3efdca5ae39cc5d923392785ae2c03bbb88c5c..d6e0c089e1b110830b0e596160867f4c3bd93856 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/config.h>
 
 #include <asm/uaccess.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/ioctl.h>
index ca5f9f90d794d27321cba47d5e8e146ab7136b7a..eaf33caa0a1f8b73dad142387216bd837dda5add 100644 (file)
@@ -23,6 +23,7 @@
  * Boston, MA 021110-1307, USA.
  */
 
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/types.h>
 #include <linux/slab.h>
index a3b3a9b5c2ff615434a9ff7b88448341dc61cded..8e20c1f32563f19aeb7386c729e2fc11c3839cfa 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -16,6 +16,7 @@
 #include <linux/tty.h>
 #include <linux/namei.h>
 #include <linux/backing-dev.h>
+#include <linux/capability.h>
 #include <linux/security.h>
 #include <linux/mount.h>
 #include <linux/vfs.h>
index 634355e169869c3369959acbe5261542bb4cacb6..20feb7568deb4e3456f596ed98318c49e6de2c09 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
 #include <linux/init.h>
+#include <linux/capability.h>
 #include <linux/file.h>
 #include <linux/string.h>
 #include <linux/seq_file.h>
index 1c7da988fcc3a3df6f1c30e372f6883fe3354937..adc2cd95169a0793b69cde85db8949a11ef8c898 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/proc_fs.h>
 #include <linux/user.h>
 #include <linux/a.out.h>
+#include <linux/capability.h>
 #include <linux/elf.h>
 #include <linux/elfcore.h>
 #include <linux/vmalloc.h>
index 124e35442ac8b8712922a0349ecde89f7596c4e4..4063fb32f78c210dd6c41690ff107966e68ed821 100644 (file)
@@ -41,7 +41,7 @@ struct proc_dir_entry *proc_vmcore = NULL;
 
 /* Reads a page from the oldmem device from given offset. */
 static ssize_t read_from_oldmem(char *buf, size_t count,
-                            loff_t *ppos, int userbuf)
+                               u64 *ppos, int userbuf)
 {
        unsigned long pfn, offset;
        size_t nr_bytes;
index d14d872646d4fc0b4082b50e6722d7467ed79d5c..ba9e0bf32f67554d7c531871be937726d3274c24 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/buffer_head.h>
+#include <linux/capability.h>
 #include <linux/quotaops.h>
 
 /* Check validity of generic quotactl commands */
index ba8bf8df6dc77743bfa690d526f2e90c09193b9b..745c8810089512e0b9a77d6f3847ea7683500037 100644 (file)
@@ -2,6 +2,7 @@
  * Copyright 2000 by Hans Reiser, licensing governed by reiserfs/README
  */
 
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/reiserfs_fs.h>
 #include <linux/time.h>
index 3f17ef844fb65ad61b373c2b746ae832a53d0aba..4491fcf2a0e60b55ca66d61f222b4a807ca0b385 100644 (file)
@@ -3925,10 +3925,13 @@ static int do_journal_end(struct reiserfs_transaction_handle *th,
                flush = 1;
        }
 #ifdef REISERFS_PREALLOCATE
-       /* quota ops might need to nest, setup the journal_info pointer for them */
+       /* quota ops might need to nest, setup the journal_info pointer for them
+        * and raise the refcount so that it is > 0. */
        current->journal_info = th;
+       th->t_refcount++;
        reiserfs_discard_all_prealloc(th);      /* it should not involve new blocks into
                                                 * the transaction */
+       th->t_refcount--;
        current->journal_info = th->t_handle_save;
 #endif
 
index 6f99e01f94abac117509ef97247624c52c30f1a9..cc061bfd437b00b4c3aed01b3e0983fb83dba152 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 #include <linux/reiserfs_fs.h>
+#include <linux/capability.h>
 #include <linux/dcache.h>
 #include <linux/namei.h>
 #include <linux/errno.h>
index 2dc953504cc021e1cf3e71462c39c79ce0221583..43de3ba833327d35618cd156d12ab96d53440c41 100644 (file)
@@ -1,3 +1,4 @@
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/posix_acl.h>
 #include <linux/reiserfs_fs.h>
index 2501f7e66ab9413effe8c08ec8607b9f90cb3b65..024a938ca60f1a77238703f648f78733f64f8df4 100644 (file)
@@ -1,4 +1,5 @@
 #include <linux/reiserfs_fs.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
index d6baec0f24ad5fb28f3bb34ba65e11428c186989..b1b878b817306c22d0a9c06712e723f8992c1c3f 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
index c3133219941cbeaa8deacc5fb13f012a6c2945b0..689f7bcfaf3043b5585853f33589d59a77398008 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/pagemap.h>
 #include <linux/namei.h>
 #include <linux/backing-dev.h>
+#include <linux/capability.h>
 #include "sysfs.h"
 
 extern struct super_block * sysfs_sb;
index 8a388289040dbb66de764c8ccc92fdade27253eb..a6f2acc1f15c01929dd0ecc48a93b6c00e981d11 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/string.h> /* memset */
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
 #include <linux/pagemap.h>
index faf1512173eb23d36cf861b651b3572ded618999..a9f4421ddb6f6e4b93975c72eb234039f48bd91a 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/string.h>
 #include <linux/quotaops.h>
 #include <linux/buffer_head.h>
+#include <linux/capability.h>
 #include <linux/sched.h>
 #include <linux/bitops.h>
 #include <asm/byteorder.h>
index 4af491024727264536ef4a0200d527dce35daa36..e7f3da61c6c39afd5f669d3faa80a577977558f9 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef __XFS_CRED_H__
 #define __XFS_CRED_H__
 
+#include <linux/capability.h>
+
 /*
  * Credentials
  */
@@ -27,7 +29,7 @@ typedef struct cred {
 
 extern struct cred *sys_cred;
 
-/* this is a hack.. (assums sys_cred is the only cred_t in the system) */
+/* this is a hack.. (assumes sys_cred is the only cred_t in the system) */
 static __inline int capable_cred(cred_t *cr, int cid)
 {
        return (cr == sys_cred) ? 1 : capable(cid);
index b3b2cfda273ccbe625d79cfacf1c382a50a0c51e..4db47790415c86f5fb043bf866f20a665a54e2b6 100644 (file)
@@ -52,6 +52,7 @@
 #include "xfs_dfrag.h"
 #include "xfs_fsops.h"
 
+#include <linux/capability.h>
 #include <linux/dcache.h>
 #include <linux/mount.h>
 #include <linux/namei.h>
index 129403958044bbae5015e787bcd6fe82bd7650c8..4bd3d03b23edf6c0ba22bda785336ad0a2e54268 100644 (file)
@@ -51,6 +51,7 @@
 #include "xfs_buf_item.h"
 #include "xfs_utils.h"
 
+#include <linux/capability.h>
 #include <linux/xattr.h>
 #include <linux/namei.h>
 #include <linux/security.h>
index 86a1d09f48d56bc1a4a569553362ed523fff6c0c..676884394aaeb598772c87e99fa48f15a328e54b 100644 (file)
@@ -15,6 +15,9 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+
+#include <linux/capability.h>
+
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_bit.h"
index cc9c91b9e77197ffdec8c497200c3ea4f64dc586..4ff0f4e41c6132227bba56c7565379aca0d90c5b 100644 (file)
@@ -36,6 +36,7 @@
 #include "xfs_mac.h"
 #include "xfs_attr.h"
 
+#include <linux/capability.h>
 #include <linux/posix_acl_xattr.h>
 
 STATIC int     xfs_acl_setmode(vnode_t *, xfs_acl_t *, int *);
index 1a11c2b517011f5e49840e92b0bebc4f92c78117..e5e91e9c7e898d9f65299813115b8373c22e4c26 100644 (file)
@@ -15,6 +15,9 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+
+#include <linux/capability.h>
+
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_types.h"
index f8916349a9c66629a0145844c759eaa38faa7687..8076cc981e11f60cf011df7870066e1d5cd1bd3b 100644 (file)
@@ -15,6 +15,9 @@
  * along with this program; if not, write the Free Software Foundation,
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
+
+#include <linux/capability.h>
+
 #include "xfs.h"
 #include "xfs_fs.h"
 #include "xfs_types.h"
index a714d0cdc204dff18b84390763114ac99fc04f09..6f92482cc96c6ebbd360c98899b4f4fc465828aa 100644 (file)
@@ -156,7 +156,7 @@ ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
        /* Always update the PCB ASN.  Another thread may have allocated
           a new mm->context (via flush_tlb_mm) without the ASN serial
           number wrapping.  We have no way to detect when this is needed.  */
-       next->thread_info->pcb.asn = mmc & HARDWARE_ASN_MASK;
+       task_thread_info(next)->pcb.asn = mmc & HARDWARE_ASN_MASK;
 }
 
 __EXTERN_INLINE void
@@ -235,7 +235,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
                if (cpu_online(i))
                        mm->context[i] = 0;
        if (tsk != current)
-               tsk->thread_info->pcb.ptbr
+               task_thread_info(tsk)->pcb.ptbr
                  = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
        return 0;
 }
@@ -249,7 +249,7 @@ destroy_context(struct mm_struct *mm)
 static inline void
 enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 {
-       tsk->thread_info->pcb.ptbr
+       task_thread_info(tsk)->pcb.ptbr
          = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
 }
 
index bb1a7a3abb8b55ac2c80aa10d608299eac295ad0..425b7b6d28cbba8e99ec8c1bbd9af578b77752df 100644 (file)
@@ -52,19 +52,10 @@ extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
 unsigned long get_wchan(struct task_struct *p);
 
-/* See arch/alpha/kernel/ptrace.c for details.  */
-#define PT_REG(reg) \
-  (PAGE_SIZE*2 - sizeof(struct pt_regs) + offsetof(struct pt_regs, reg))
-
-#define SW_REG(reg) \
- (PAGE_SIZE*2 - sizeof(struct pt_regs) - sizeof(struct switch_stack) \
-  + offsetof(struct switch_stack, reg))
-
-#define KSTK_EIP(tsk) \
-  (*(unsigned long *)(PT_REG(pc) + (unsigned long) ((tsk)->thread_info)))
+#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
 
 #define KSTK_ESP(tsk) \
-  ((tsk) == current ? rdusp() : (tsk)->thread_info->pcb.usp)
+  ((tsk) == current ? rdusp() : task_thread_info(tsk)->pcb.usp)
 
 #define cpu_relax()    barrier()
 
index 072375c135b4a008799173b655837fb39c3d2b91..9933b8b3612ee2a6173d22ba5bd441d07c80eab5 100644 (file)
@@ -75,10 +75,10 @@ struct switch_stack {
 #define profile_pc(regs) instruction_pointer(regs)
 extern void show_regs(struct pt_regs *);
 
-#define alpha_task_regs(task) \
-  ((struct pt_regs *) ((long) (task)->thread_info + 2*PAGE_SIZE) - 1)
+#define task_pt_regs(task) \
+  ((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1)
 
-#define force_successful_syscall_return() (alpha_task_regs(current)->r0 = 0)
+#define force_successful_syscall_return() (task_pt_regs(current)->r0 = 0)
 
 #endif
 
index 050e86d12891ef704762adba37cabe4a5cb19fe4..cc9c7e8cced5c2de6f88f3557de2bd6c4c3de385 100644 (file)
@@ -131,15 +131,25 @@ struct el_common_EV6_mcheck {
 extern void halt(void) __attribute__((noreturn));
 #define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
 
-#define switch_to(P,N,L)                                               \
-  do {                                                                 \
-    (L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P));  \
-    check_mmu_context();                                               \
+#define switch_to(P,N,L)                                                \
+  do {                                                                  \
+    (L) = alpha_switch_to(virt_to_phys(&task_thread_info(N)->pcb), (P)); \
+    check_mmu_context();                                                \
   } while (0)
 
 struct task_struct;
 extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 #define imb() \
 __asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
 
index d51491ed00b81de8ae49426d5cc07e6c6fa97f5a..69ffd93f8e223a3aafd4eb0cc2400c799a8be317 100644 (file)
@@ -54,8 +54,6 @@ register struct thread_info *__current_thread_info __asm__("$8");
 #define alloc_thread_info(tsk) \
   ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #endif /* __ASSEMBLY__ */
 
index 7d4118e090542222ec87020f9840e21f121b43ec..31290694648b095d2a4595c91a9b2825bb72bf6b 100644 (file)
@@ -85,9 +85,11 @@ unsigned long get_wchan(struct task_struct *p);
  */
 extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
 
-#define KSTK_REGS(tsk) (((struct pt_regs *)(THREAD_START_SP + (unsigned long)(tsk)->thread_info)) - 1)
-#define KSTK_EIP(tsk)  KSTK_REGS(tsk)->ARM_pc
-#define KSTK_ESP(tsk)  KSTK_REGS(tsk)->ARM_sp
+#define task_pt_regs(p) \
+       ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
+
+#define KSTK_EIP(tsk)  task_pt_regs(tsk)->ARM_pc
+#define KSTK_ESP(tsk)  task_pt_regs(tsk)->ARM_sp
 
 /*
  * Prefetching support - only ARMv5.
index 5621d61ebc07958e9e7a671def64f410fe26dcb1..eb2de8c10515d118aa8616e27adb2f6accd149ad 100644 (file)
@@ -168,9 +168,19 @@ extern struct task_struct *__switch_to(struct task_struct *, struct thread_info
 
 #define switch_to(prev,next,last)                                      \
 do {                                                                   \
-       last = __switch_to(prev,prev->thread_info,next->thread_info);   \
+       last = __switch_to(prev,task_thread_info(prev), task_thread_info(next));        \
 } while (0)
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 /*
  * CPU interrupt mask handling.
  */
index 7c98557b717ff048003e0d07c6a5e820c9ccf4e6..33a33cbb63295640fc5664aa7ba69255eecbdd6f 100644 (file)
@@ -96,13 +96,10 @@ static inline struct thread_info *current_thread_info(void)
 extern struct thread_info *alloc_thread_info(struct task_struct *task);
 extern void free_thread_info(struct thread_info *);
 
-#define get_thread_info(ti)    get_task_struct((ti)->task)
-#define put_thread_info(ti)    put_task_struct((ti)->task)
-
 #define thread_saved_pc(tsk)   \
-       ((unsigned long)(pc_pointer((tsk)->thread_info->cpu_context.pc)))
+       ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
 #define thread_saved_fp(tsk)   \
-       ((unsigned long)((tsk)->thread_info->cpu_context.fp))
+       ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
 
 extern void iwmmxt_task_disable(struct thread_info *);
 extern void iwmmxt_task_copy(struct thread_info *, void *);
index f23fac1938f31d035872e39fd46688b69064824e..ca4ccfc4b578cc44184667aaac94b5b0d9764022 100644 (file)
@@ -111,9 +111,19 @@ extern struct task_struct *__switch_to(struct task_struct *, struct thread_info
 
 #define switch_to(prev,next,last)                                      \
 do {                                                                   \
-       last = __switch_to(prev,prev->thread_info,next->thread_info);   \
+       last = __switch_to(prev,task_thread_info(prev),task_thread_info(next)); \
 } while (0)
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 /*
  * Save the current interrupt enable state & disable IRQs
  */
index aff3e5699c64cfd79f1ea1f3624e2d094a947877..a65e58a0a767986a5756bfa353e3d9057ba6a08d 100644 (file)
@@ -82,18 +82,15 @@ static inline struct thread_info *current_thread_info(void)
 
 /* FIXME - PAGE_SIZE < 32K */
 #define THREAD_SIZE            (8*32768) // FIXME - this needs attention (see kernel/fork.c which gets a nice div by zero if this is lower than 8*32768
-#define __get_user_regs(x) (((struct pt_regs *)((unsigned long)(x) + THREAD_SIZE - 8)) - 1)
+#define task_pt_regs(task) ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE - 8) - 1)
 
 extern struct thread_info *alloc_thread_info(struct task_struct *task);
 extern void free_thread_info(struct thread_info *);
 
-#define get_thread_info(ti)    get_task_struct((ti)->task)
-#define put_thread_info(ti)    put_task_struct((ti)->task)
-
 #define thread_saved_pc(tsk)   \
-       ((unsigned long)(pc_pointer((tsk)->thread_info->cpu_context.pc)))
+       ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
 #define thread_saved_fp(tsk)   \
-       ((unsigned long)((tsk)->thread_info->cpu_context.fp))
+       ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
 
 #else /* !__ASSEMBLY__ */
 
index e23df8dc96e8c7d80633e0165e6757ffd2467583..cc692c7a0660cb79b5644ba324068d825e5a94b7 100644 (file)
@@ -40,7 +40,7 @@ struct thread_struct {
 #define KSTK_EIP(tsk)  \
 ({                     \
        unsigned long eip = 0;   \
-       unsigned long regs = (unsigned long)user_regs(tsk); \
+       unsigned long regs = (unsigned long)task_pt_regs(tsk); \
        if (regs > PAGE_SIZE && \
                virt_addr_valid(regs)) \
        eip = ((struct pt_regs *)regs)->irp; \
index 8c939bf27987f36a6c89cb3acfe6db6d874f2419..32bf2e538ced1913b7618e2b13360a09ee65bb9a 100644 (file)
@@ -36,7 +36,7 @@ struct thread_struct {
 #define KSTK_EIP(tsk)          \
 ({                             \
        unsigned long eip = 0;  \
-       unsigned long regs = (unsigned long)user_regs(tsk); \
+       unsigned long regs = (unsigned long)task_pt_regs(tsk); \
        if (regs > PAGE_SIZE && virt_addr_valid(regs))      \
                eip = ((struct pt_regs *)regs)->erp;        \
        eip; \
index dce41009eeb086a17811c7e1095709672ddedac4..961e2bceadbc645915fd1379ed939cf008db19ff 100644 (file)
@@ -45,7 +45,8 @@ struct task_struct;
  * Dito but for the currently running task
  */
 
-#define current_regs() user_regs(current->thread_info)
+#define task_pt_regs(task) user_regs(task_thread_info(task))
+#define current_regs() task_pt_regs(current)
 
 static inline void prepare_to_copy(struct task_struct *tsk)
 {
index cef0140fc10425b99fbe9eba492c05ac9a86a9ac..7ad853c3f74e871afcef861d84685c5360b82dce 100644 (file)
@@ -69,8 +69,6 @@ struct thread_info {
 /* thread information allocation */
 #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #endif /* !__ASSEMBLY__ */
 
index 60f6b2aee76d7dc94666b4fc6e5bd24ef6a0e6e7..a5576e02dd1d08a8bb4d4970e641751b17e05a87 100644 (file)
@@ -110,8 +110,6 @@ register struct thread_info *__current_thread_info asm("gr15");
 #endif
 
 #define free_thread_info(info) kfree(info)
-#define get_thread_info(ti)    get_task_struct((ti)->task)
-#define put_thread_info(ti)    put_task_struct((ti)->task)
 
 #else /* !__ASSEMBLY__ */
 
index 74b18cda169f92777ffd19f743ab65f6d841bd52..40c6d1f8659846cb05cd57c524b296dfa7617a17 100644 (file)
@@ -97,7 +97,7 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
         * the mutex state would be.
         */
 #ifdef __HAVE_ARCH_CMPXCHG
-       if (likely(atomic_cmpxchg(count, 1, 0)) == 1) {
+       if (likely(atomic_cmpxchg(count, 1, 0) == 1)) {
                smp_mb();
                return 1;
        }
index e8c02b8c2d99bb2d138ca200008bf5467d105fd1..cd35b1cc6cdeffbc228f463a67193f24434489f1 100644 (file)
 
 #include <asm/setup.h>
 
-#if !defined(CONFIG_SMALL_TASKS) && PAGE_SHIFT < 13
-#define KTHREAD_SIZE (8192)
-#else
-#define KTHREAD_SIZE PAGE_SIZE
-#endif
 #ifndef __ASSEMBLY__
  
 #define get_user_page(vaddr)           __get_free_page(GFP_KERNEL)
index bfcc755c3bb1f647057648d0a5e935534a336265..45f09dc9caff4afe5692b0a05ae38b7a144acc1d 100644 (file)
@@ -69,8 +69,6 @@ static inline struct thread_info *current_thread_info(void)
 #define alloc_thread_info(tsk) ((struct thread_info *) \
                                __get_free_pages(GFP_KERNEL, 1))
 #define free_thread_info(ti)   free_pages((unsigned long) (ti), 1)
-#define get_thread_info(ti)    get_task_struct((ti)->task)
-#define put_thread_info(ti)    put_task_struct((ti)->task)
 #endif /* __ASSEMBLY__ */
 
 /*
index 8c454aa58ac6b157441ad2a77f9211e4a30f882e..d30b8571573fd7dcb87d225f287b746c85cbdd8f 100644 (file)
@@ -132,6 +132,11 @@ extern unsigned int nmi_watchdog;
 
 extern int disable_timer_pin_1;
 
+void smp_send_timer_broadcast_ipi(struct pt_regs *regs);
+void switch_APIC_timer_to_ipi(void *cpumask);
+void switch_ipi_to_APIC_timer(void *cpumask);
+#define ARCH_APICTIMER_STOPS_ON_C3     1
+
 #else /* !CONFIG_X86_LOCAL_APIC */
 static inline void lapic_shutdown(void) { }
 
index 65679aca4b2229ffb4e5b1781363ee8f10ef8efd..fe0819fe9c6496584ff958393c2f6a5381bd9b47 100644 (file)
@@ -43,7 +43,7 @@ static inline void set_bit(int nr, volatile unsigned long * addr)
 {
        __asm__ __volatile__( LOCK_PREFIX
                "btsl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"Ir" (nr));
 }
 
@@ -60,7 +60,7 @@ static inline void __set_bit(int nr, volatile unsigned long * addr)
 {
        __asm__(
                "btsl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"Ir" (nr));
 }
 
@@ -78,7 +78,7 @@ static inline void clear_bit(int nr, volatile unsigned long * addr)
 {
        __asm__ __volatile__( LOCK_PREFIX
                "btrl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"Ir" (nr));
 }
 
@@ -86,7 +86,7 @@ static inline void __clear_bit(int nr, volatile unsigned long * addr)
 {
        __asm__ __volatile__(
                "btrl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"Ir" (nr));
 }
 #define smp_mb__before_clear_bit()     barrier()
@@ -105,7 +105,7 @@ static inline void __change_bit(int nr, volatile unsigned long * addr)
 {
        __asm__ __volatile__(
                "btcl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"Ir" (nr));
 }
 
@@ -123,7 +123,7 @@ static inline void change_bit(int nr, volatile unsigned long * addr)
 {
        __asm__ __volatile__( LOCK_PREFIX
                "btcl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"Ir" (nr));
 }
 
@@ -142,7 +142,7 @@ static inline int test_and_set_bit(int nr, volatile unsigned long * addr)
 
        __asm__ __volatile__( LOCK_PREFIX
                "btsl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"Ir" (nr) : "memory");
        return oldbit;
 }
@@ -162,7 +162,7 @@ static inline int __test_and_set_bit(int nr, volatile unsigned long * addr)
 
        __asm__(
                "btsl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"Ir" (nr));
        return oldbit;
 }
@@ -182,7 +182,7 @@ static inline int test_and_clear_bit(int nr, volatile unsigned long * addr)
 
        __asm__ __volatile__( LOCK_PREFIX
                "btrl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"Ir" (nr) : "memory");
        return oldbit;
 }
@@ -202,7 +202,7 @@ static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
 
        __asm__(
                "btrl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"Ir" (nr));
        return oldbit;
 }
@@ -214,7 +214,7 @@ static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
 
        __asm__ __volatile__(
                "btcl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"Ir" (nr) : "memory");
        return oldbit;
 }
@@ -233,7 +233,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long* addr)
 
        __asm__ __volatile__( LOCK_PREFIX
                "btcl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"Ir" (nr) : "memory");
        return oldbit;
 }
index ff1187e80c32f4a657a28c1b5ab4e4ec98dd5550..c4ec2a4d8fdf701e33b0879b1ff4830b963f7ad4 100644 (file)
@@ -69,6 +69,7 @@
 #define X86_FEATURE_K7         (3*32+ 5) /* Athlon */
 #define X86_FEATURE_P3         (3*32+ 6) /* P3 */
 #define X86_FEATURE_P4         (3*32+ 7) /* P4 */
+#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3       (4*32+ 0) /* Streaming SIMD Extensions-3 */
index 6c37a9ab8d607e5a7121fa227ee3785110a9ac7d..9cf20cacf76e8cf61cc9e6157a7a4acdb42b783d 100644 (file)
@@ -6,6 +6,7 @@
 #include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/scatterlist.h>
+#include <asm/bug.h>
 
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
@@ -20,7 +21,9 @@ static inline dma_addr_t
 dma_map_single(struct device *dev, void *ptr, size_t size,
               enum dma_data_direction direction)
 {
-       BUG_ON(direction == DMA_NONE);
+       if (direction == DMA_NONE)
+               BUG();
+       WARN_ON(size == 0);
        flush_write_buffers();
        return virt_to_phys(ptr);
 }
@@ -29,7 +32,8 @@ static inline void
 dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
                 enum dma_data_direction direction)
 {
-       BUG_ON(direction == DMA_NONE);
+       if (direction == DMA_NONE)
+               BUG();
 }
 
 static inline int
@@ -38,7 +42,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
 {
        int i;
 
-       BUG_ON(direction == DMA_NONE);
+       if (direction == DMA_NONE)
+               BUG();
+       WARN_ON(nents == 0 || sg[0].length == 0);
 
        for (i = 0; i < nents; i++ ) {
                BUG_ON(!sg[i].page);
index 6747006743f94f49abf8339cdced9f988ce2e359..152d0baa576a675b39bfa408a6b69f670e8ad118 100644 (file)
@@ -49,19 +49,19 @@ static inline void __save_init_fpu( struct task_struct *tsk )
                X86_FEATURE_FXSR,
                "m" (tsk->thread.i387.fxsave)
                :"memory");
-       tsk->thread_info->status &= ~TS_USEDFPU;
+       task_thread_info(tsk)->status &= ~TS_USEDFPU;
 }
 
 #define __unlazy_fpu( tsk ) do { \
-       if ((tsk)->thread_info->status & TS_USEDFPU) \
+       if (task_thread_info(tsk)->status & TS_USEDFPU) \
                save_init_fpu( tsk ); \
 } while (0)
 
 #define __clear_fpu( tsk )                                     \
 do {                                                           \
-       if ((tsk)->thread_info->status & TS_USEDFPU) {          \
+       if (task_thread_info(tsk)->status & TS_USEDFPU) {               \
                asm volatile("fnclex ; fwait");                         \
-               (tsk)->thread_info->status &= ~TS_USEDFPU;      \
+               task_thread_info(tsk)->status &= ~TS_USEDFPU;   \
                stts();                                         \
        }                                                       \
 } while (0)
index 7babb97a02eb6976df24e77d87f8220423f70e15..03233c2ab82009c73bf1a30cf2858c2e01651a6a 100644 (file)
@@ -131,6 +131,11 @@ extern void iounmap(volatile void __iomem *addr);
 extern void *bt_ioremap(unsigned long offset, unsigned long size);
 extern void bt_iounmap(void *addr, unsigned long size);
 
+/* Use early IO mappings for DMI because it's initialized early */
+#define dmi_ioremap bt_ioremap
+#define dmi_iounmap bt_iounmap
+#define dmi_alloc alloc_bootmem
+
 /*
  * ISA I/O bus memory addresses are 1:1 with the physical address.
  */
index cc756a67cd63fee819143ff9994acf675de2de75..a1d0072e36bc8f9fc15163544b2c374db789527a 100644 (file)
@@ -15,11 +15,9 @@ static inline void __local_send_IPI_allbutself(int vector)
 {
        if (no_broadcast) {
                cpumask_t mask = cpu_online_map;
-               int this_cpu = get_cpu();
 
-               cpu_clear(this_cpu, mask);
+               cpu_clear(smp_processor_id(), mask);
                send_IPI_mask(mask, vector);
-               put_cpu();
        } else
                __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
 }
index c657d4b09f0a23d96f0cdf24bb606201f49751dd..9b2199e829f36c7b1606b74f7e4b3f5bc6f61fd3 100644 (file)
@@ -125,7 +125,7 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
         * the mutex state would be.
         */
 #ifdef __HAVE_ARCH_CMPXCHG
-       if (likely(atomic_cmpxchg(count, 1, 0)) == 1)
+       if (likely(atomic_cmpxchg(count, 1, 0) == 1))
                return 1;
        return 0;
 #else
index 5c96cf6dcb3916f5735cdf6005b2ac7b3755cd4d..feca5d961e2b0c26a20c89f2b67c1cac230866fc 100644 (file)
@@ -61,9 +61,11 @@ struct cpuinfo_x86 {
        int     x86_cache_size;  /* in KB - valid for CPUS which support this
                                    call  */
        int     x86_cache_alignment;    /* In bytes */
-       int     fdiv_bug;
-       int     f00f_bug;
-       int     coma_bug;
+       char    fdiv_bug;
+       char    f00f_bug;
+       char    coma_bug;
+       char    pad0;
+       int     x86_power;
        unsigned long loops_per_jiffy;
        unsigned char x86_max_cores;    /* cpuid returned max cores value */
        unsigned char booted_cores;     /* number of cores as seen by OS */
@@ -279,9 +281,11 @@ static inline void clear_in_cr4 (unsigned long mask)
        outb((data), 0x23); \
 } while (0)
 
-static inline void serialize_cpu(void)
+/* Stop speculative execution */
+static inline void sync_core(void)
 {
-        __asm__ __volatile__ ("cpuid" : : : "ax", "bx", "cx", "dx");
+       int tmp;
+       asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
 }
 
 static inline void __monitor(const void *eax, unsigned long ecx,
@@ -557,10 +561,20 @@ unsigned long get_wchan(struct task_struct *p);
        (unsigned long)(&__ptr[THREAD_SIZE_LONGS]);                     \
 })
 
+/*
+ * The below -8 is to reserve 8 bytes on top of the ring0 stack.
+ * This is necessary to guarantee that the entire "struct pt_regs"
+ * is accessable even if the CPU haven't stored the SS/ESP registers
+ * on the stack (interrupt gate does not save these registers
+ * when switching to the same priv ring).
+ * Therefore beware: accessing the xss/esp fields of the
+ * "struct pt_regs" is possible, but they may contain the
+ * completely wrong values.
+ */
 #define task_pt_regs(task)                                             \
 ({                                                                     \
        struct pt_regs *__regs__;                                       \
-       __regs__ = (struct pt_regs *)KSTK_TOP((task)->thread_info);     \
+       __regs__ = (struct pt_regs *)(KSTK_TOP(task_stack_page(task))-8); \
        __regs__ - 1;                                                   \
 })
 
index 9c0593b7a94e9220c238c9a9b895b694d940ad7f..36a92ed6a9d0d7a916c60f33313bec9d4fb0c494 100644 (file)
@@ -548,6 +548,15 @@ void enable_hlt(void);
 extern int es7000_plat;
 void cpu_idle_wait(void);
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible:
+ */
+static inline void sched_cacheflush(void)
+{
+       wbinvd();
+}
+
 extern unsigned long arch_align_stack(unsigned long sp);
 
 #endif
index 8fbf791651bf84cfaf8e2bbb3396e76b13c87517..2493e77e8c3052da1da84626d187cc5a312f922f 100644 (file)
@@ -111,8 +111,6 @@ register unsigned long current_stack_pointer asm("esp") __attribute_used__;
 #endif
 
 #define free_thread_info(info) kfree(info)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #else /* !__ASSEMBLY__ */
 
index 0ec27c9e8e45ba696be1a06a81df49d27d222729..d7e19eb344b7ab4f83c6611ec3afb675edf86d13 100644 (file)
@@ -72,7 +72,6 @@ static inline int node_to_first_cpu(int node)
        .max_interval           = 32,                   \
        .busy_factor            = 32,                   \
        .imbalance_pct          = 125,                  \
-       .cache_hot_time         = (10*1000000),         \
        .cache_nice_tries       = 1,                    \
        .busy_idx               = 3,                    \
        .idle_idx               = 1,                    \
index aaf11f4e916997643d60c7d45fb4718ac5092363..c0b19106665ca1d45bc0e8e3c20bd76190a981e1 100644 (file)
@@ -192,7 +192,7 @@ compat_ptr (compat_uptr_t uptr)
 static __inline__ void __user *
 compat_alloc_user_space (long len)
 {
-       struct pt_regs *regs = ia64_task_regs(current);
+       struct pt_regs *regs = task_pt_regs(current);
        return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
 }
 
index 94e07e7273955b1174537b9f0093612c057c1ee0..8c648bf72bbdb796a6321713a42c19fb18b62d71 100644 (file)
@@ -352,7 +352,7 @@ extern unsigned long get_wchan (struct task_struct *p);
 /* Return instruction pointer of blocked task TSK.  */
 #define KSTK_EIP(tsk)                                  \
   ({                                                   \
-       struct pt_regs *_regs = ia64_task_regs(tsk);    \
+       struct pt_regs *_regs = task_pt_regs(tsk);      \
        _regs->cr_iip + ia64_psr(_regs)->ri;            \
   })
 
index 2c703d6e0c8630aa234039d0ebdca4d9ce04dc09..9471cdc3f4c0989a3a8d34a37035f06918e96232 100644 (file)
@@ -248,7 +248,7 @@ struct switch_stack {
 })
 
   /* given a pointer to a task_struct, return the user's pt_regs */
-# define ia64_task_regs(t)             (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
+# define task_pt_regs(t)               (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
 # define ia64_psr(regs)                        ((struct ia64_psr *) &(regs)->cr_ipsr)
 # define user_mode(regs)               (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0)
 # define user_stack(task,regs) ((long) regs - (long) task == IA64_STK_OFFSET - sizeof(*regs))
@@ -271,7 +271,7 @@ struct switch_stack {
    *
    * On ia64, we can clear the user's pt_regs->r8 to force a successful syscall.
    */
-# define force_successful_syscall_return()     (ia64_task_regs(current)->r8 = 0)
+# define force_successful_syscall_return()     (task_pt_regs(current)->r8 = 0)
 
   struct task_struct;                  /* forward decl */
   struct unw_frame_info;               /* forward decl */
index 635235fa1e32606c5955653bed40d0a77cb4899c..80c5a234e2599c90006de76e27b47f49b6197ade 100644 (file)
@@ -219,14 +219,14 @@ extern void ia64_load_extra (struct task_struct *task);
 
 #define IA64_HAS_EXTRA_STATE(t)                                                        \
        ((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID)       \
-        || IS_IA32_PROCESS(ia64_task_regs(t)) || PERFMON_IS_SYSWIDE())
+        || IS_IA32_PROCESS(task_pt_regs(t)) || PERFMON_IS_SYSWIDE())
 
 #define __switch_to(prev,next,last) do {                                                        \
        if (IA64_HAS_EXTRA_STATE(prev))                                                          \
                ia64_save_extra(prev);                                                           \
        if (IA64_HAS_EXTRA_STATE(next))                                                          \
                ia64_load_extra(next);                                                           \
-       ia64_psr(ia64_task_regs(next))->dfh = !ia64_is_local_fpu_owner(next);                    \
+       ia64_psr(task_pt_regs(next))->dfh = !ia64_is_local_fpu_owner(next);                      \
        (last) = ia64_switch_to((next));                                                         \
 } while (0)
 
@@ -238,8 +238,8 @@ extern void ia64_load_extra (struct task_struct *task);
  * the latest fph state from another CPU.  In other words: eager save, lazy restore.
  */
 # define switch_to(prev,next,last) do {                                                \
-       if (ia64_psr(ia64_task_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) {                             \
-               ia64_psr(ia64_task_regs(prev))->mfh = 0;                        \
+       if (ia64_psr(task_pt_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) {                               \
+               ia64_psr(task_pt_regs(prev))->mfh = 0;                  \
                (prev)->thread.flags |= IA64_THREAD_FPH_VALID;                  \
                __ia64_save_fpu((prev)->thread.fph);                            \
        }                                                                       \
@@ -279,6 +279,7 @@ extern void ia64_load_extra (struct task_struct *task);
 #define ia64_platform_is(x) (strcmp(x, platform_name) == 0)
 
 void cpu_idle_wait(void);
+void sched_cacheflush(void);
 
 #define arch_align_stack(x) (x)
 
index 171b2207bde4e70a9936a19a56899eca95962a6d..653bb7f9a7532dbd62841b6dfbdf28897039f2f5 100644 (file)
@@ -57,11 +57,20 @@ struct thread_info {
 /* how to get the thread information struct from C */
 #define current_thread_info()  ((struct thread_info *) ((char *) current + IA64_TASK_SIZE))
 #define alloc_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
+#define task_thread_info(tsk)  ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
 #else
 #define current_thread_info()  ((struct thread_info *) 0)
 #define alloc_thread_info(tsk) ((struct thread_info *) 0)
+#define task_thread_info(tsk)  ((struct thread_info *) 0)
 #endif
 #define free_thread_info(ti)   /* nothing */
+#define task_stack_page(tsk)   ((void *)(tsk))
+
+#define __HAVE_THREAD_FUNCTIONS
+#define setup_thread_stack(p, org) \
+       *task_thread_info(p) = *task_thread_info(org); \
+       task_thread_info(p)->task = (p);
+#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
 
 #define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
 #define alloc_task_struct()    ((task_t *)__get_free_pages(GFP_KERNEL, KERNEL_STACK_SIZE_ORDER))
index f7c330467e7e92247993d6b1fe3b1b3c7ed950a6..d8aae4da3978945adae91064c3ebbe8d0b29f01b 100644 (file)
@@ -55,7 +55,6 @@ void build_cpu_to_node_map(void);
        .max_interval           = 4,                    \
        .busy_factor            = 64,                   \
        .imbalance_pct          = 125,                  \
-       .cache_hot_time         = (10*1000000),         \
        .per_cpu_gain           = 100,                  \
        .cache_nice_tries       = 2,                    \
        .busy_idx               = 2,                    \
@@ -81,7 +80,6 @@ void build_cpu_to_node_map(void);
        .max_interval           = 8*(min(num_online_cpus(), 32)), \
        .busy_factor            = 64,                   \
        .imbalance_pct          = 125,                  \
-       .cache_hot_time         = (10*1000000),         \
        .cache_nice_tries       = 2,                    \
        .busy_idx               = 3,                    \
        .idle_idx               = 2,                    \
index 55cd7ecfde4370c6f34c1e88bef4df48e18b6643..0d058b2d844e468ac6d6ac448a553dfa1d752528 100644 (file)
@@ -163,6 +163,9 @@ extern void show_regs(struct pt_regs *);
 
 extern void withdraw_debug_trap(struct pt_regs *regs);
 
+#define task_pt_regs(task) \
+        ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1)
+
 #endif /* __KERNEL */
 
 #endif /* _ASM_M32R_PTRACE_H */
index dcf619a0a0b03285fd55976f2b0a1fc3ec6c7e49..06c12a037cba557aab39a27eb302adbdf97d67f7 100644 (file)
        last = __last; \
 } while(0)
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 /* Interrupt Control */
 #if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104)
 #define local_irq_enable() \
index 0f589363f619cd6f26e08d668e0de604dd7cd6eb..22aff3222d22a3790b22791fcacd1cdc94baf72e 100644 (file)
@@ -110,8 +110,6 @@ static inline struct thread_info *current_thread_info(void)
 #endif
 
 #define free_thread_info(info) kfree(info)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #define TI_FLAG_FAULT_CODE_SHIFT       28
 
index 3ae5d8d55ba991536f450aebb2e35c6664ee60b7..a16fe4e5a28a4159edc4c0c08ffad39313c74fad 100644 (file)
@@ -274,7 +274,7 @@ struct CIA {
 #define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase)
 
 #define CUSTOM_PHYSADDR     (0xdff000)
-#define custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
+#define amiga_custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
 
 #define CIAA_PHYSADDR    (0xbfe001)
 #define CIAB_PHYSADDR    (0xbfd000)
@@ -294,12 +294,12 @@ static inline void amifb_video_off(void)
 {
        if (amiga_chipset == CS_ECS || amiga_chipset == CS_AGA) {
                /* program Denise/Lisa for a higher maximum play rate */
-               custom.htotal = 113;        /* 31 kHz */
-               custom.vtotal = 223;        /* 70 Hz */
-               custom.beamcon0 = 0x4390;   /* HARDDIS, VAR{BEAM,VSY,HSY,CSY}EN */
+               amiga_custom.htotal = 113;        /* 31 kHz */
+               amiga_custom.vtotal = 223;        /* 70 Hz */
+               amiga_custom.beamcon0 = 0x4390;   /* HARDDIS, VAR{BEAM,VSY,HSY,CSY}EN */
                /* suspend the monitor */
-               custom.hsstrt = custom.hsstop = 116;
-               custom.vsstrt = custom.vsstop = 226;
+               amiga_custom.hsstrt = amiga_custom.hsstop = 116;
+               amiga_custom.vsstrt = amiga_custom.vsstop = 226;
                amiga_audio_min_period = 57;
        }
 }
index 2aff4cfbf7b3837013f4f3b94a177f52a41f2028..aa968d014bb6b9502a55160682a0b101a34f9f29 100644 (file)
 extern void amiga_do_irq(int irq, struct pt_regs *fp);
 extern void amiga_do_irq_list(int irq, struct pt_regs *fp);
 
-extern unsigned short amiga_intena_vals[];
-
 /* CIA interrupt control register bits */
 
 #define CIA_ICR_TA     0x01
index 78860c20db01b29260b000868a84ee6bdc771b30..17280ef719f561844a67fe4ffe233f108cdd7867 100644 (file)
@@ -25,7 +25,7 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
  * better 64-bit) boundary
  */
 
-extern unsigned int csum_partial_copy_from_user(const unsigned char *src,
+extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
                                                unsigned char *dst,
                                                int len, int sum,
                                                int *csum_err);
index ab3dd33e23a116e81916a93cce09960981301940..2d8c0c9f794b3dfc314ba4d357ec63900473daac 100644 (file)
@@ -13,7 +13,7 @@
 /* Used for uploading DSP binary code */
 struct dsp56k_upload {
        int len;
-       char *bin;
+       char __user *bin;
 };
 
 /* For the DSP host flags */
index c6e708dd9f624fd14dcb298c4055442008b98e2e..63a05ed95c17f1fd833385364c1fab00c1bf9bab 100644 (file)
@@ -46,7 +46,7 @@ asmlinkage irqreturn_t floppy_hardint(int irq, void *dev_id,
 
 static int virtual_dma_count=0;
 static int virtual_dma_residue=0;
-static char *virtual_dma_addr=0;
+static char *virtual_dma_addr=NULL;
 static int virtual_dma_mode=0;
 static int doing_pdma=0;
 
index 728318bf7f0e996f25e9764ceb366ef2cd54c101..5e1c5826c83d179e3d4f3228a884f7673b476e21 100644 (file)
@@ -14,13 +14,4 @@ typedef struct {
 
 #define HARDIRQ_BITS   8
 
-/*
- * The hardirq mask has to be large enough to have
- * space for potentially all IRQ sources in the system
- * nesting on a single CPU:
- */
-#if (1 << HARDIRQ_BITS) < NR_IRQS
-# error HARDIRQ_BITS is too low!
-#endif
-
 #endif
index 6bb8b0d8f99d10f5229cd0467ed229657a8aa113..dcfaa352d34c072fcee570059d5d29d62da4768b 100644 (file)
@@ -24,6 +24,7 @@
 #ifdef __KERNEL__
 
 #include <linux/config.h>
+#include <linux/compiler.h>
 #include <asm/raw_io.h>
 #include <asm/virtconvert.h>
 
@@ -120,68 +121,68 @@ extern int isa_sex;
  * be compiled in so the case statement will be optimised away
  */
 
-static inline u8 *isa_itb(unsigned long addr)
+static inline u8 __iomem *isa_itb(unsigned long addr)
 {
   switch(ISA_TYPE)
     {
 #ifdef CONFIG_Q40
-    case Q40_ISA: return (u8 *)Q40_ISA_IO_B(addr);
+    case Q40_ISA: return (u8 __iomem *)Q40_ISA_IO_B(addr);
 #endif
 #ifdef CONFIG_GG2
-    case GG2_ISA: return (u8 *)GG2_ISA_IO_B(addr);
+    case GG2_ISA: return (u8 __iomem *)GG2_ISA_IO_B(addr);
 #endif
 #ifdef CONFIG_AMIGA_PCMCIA
-    case AG_ISA: return (u8 *)AG_ISA_IO_B(addr);
+    case AG_ISA: return (u8 __iomem *)AG_ISA_IO_B(addr);
 #endif
-    default: return 0; /* avoid warnings, just in case */
+    default: return NULL; /* avoid warnings, just in case */
     }
 }
-static inline u16 *isa_itw(unsigned long addr)
+static inline u16 __iomem *isa_itw(unsigned long addr)
 {
   switch(ISA_TYPE)
     {
 #ifdef CONFIG_Q40
-    case Q40_ISA: return (u16 *)Q40_ISA_IO_W(addr);
+    case Q40_ISA: return (u16 __iomem *)Q40_ISA_IO_W(addr);
 #endif
 #ifdef CONFIG_GG2
-    case GG2_ISA: return (u16 *)GG2_ISA_IO_W(addr);
+    case GG2_ISA: return (u16 __iomem *)GG2_ISA_IO_W(addr);
 #endif
 #ifdef CONFIG_AMIGA_PCMCIA
-    case AG_ISA: return (u16 *)AG_ISA_IO_W(addr);
+    case AG_ISA: return (u16 __iomem *)AG_ISA_IO_W(addr);
 #endif
-    default: return 0; /* avoid warnings, just in case */
+    default: return NULL; /* avoid warnings, just in case */
     }
 }
-static inline u8 *isa_mtb(unsigned long addr)
+static inline u8 __iomem *isa_mtb(unsigned long addr)
 {
   switch(ISA_TYPE)
     {
 #ifdef CONFIG_Q40
-    case Q40_ISA: return (u8 *)Q40_ISA_MEM_B(addr);
+    case Q40_ISA: return (u8 __iomem *)Q40_ISA_MEM_B(addr);
 #endif
 #ifdef CONFIG_GG2
-    case GG2_ISA: return (u8 *)GG2_ISA_MEM_B(addr);
+    case GG2_ISA: return (u8 __iomem *)GG2_ISA_MEM_B(addr);
 #endif
 #ifdef CONFIG_AMIGA_PCMCIA
-    case AG_ISA: return (u8 *)addr;
+    case AG_ISA: return (u8 __iomem *)addr;
 #endif
-    default: return 0; /* avoid warnings, just in case */
+    default: return NULL; /* avoid warnings, just in case */
     }
 }
-static inline u16 *isa_mtw(unsigned long addr)
+static inline u16 __iomem *isa_mtw(unsigned long addr)
 {
   switch(ISA_TYPE)
     {
 #ifdef CONFIG_Q40
-    case Q40_ISA: return (u16 *)Q40_ISA_MEM_W(addr);
+    case Q40_ISA: return (u16 __iomem *)Q40_ISA_MEM_W(addr);
 #endif
 #ifdef CONFIG_GG2
-    case GG2_ISA: return (u16 *)GG2_ISA_MEM_W(addr);
+    case GG2_ISA: return (u16 __iomem *)GG2_ISA_MEM_W(addr);
 #endif
 #ifdef CONFIG_AMIGA_PCMCIA
-    case AG_ISA: return (u16 *)addr;
+    case AG_ISA: return (u16 __iomem *)addr;
 #endif
-    default: return 0; /* avoid warnings, just in case */
+    default: return NULL; /* avoid warnings, just in case */
     }
 }
 
@@ -326,20 +327,20 @@ static inline void isa_delay(void)
 
 #define mmiowb()
 
-static inline void *ioremap(unsigned long physaddr, unsigned long size)
+static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
 {
        return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
-static inline void *ioremap_nocache(unsigned long physaddr, unsigned long size)
+static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned long size)
 {
        return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
-static inline void *ioremap_writethrough(unsigned long physaddr,
+static inline void __iomem *ioremap_writethrough(unsigned long physaddr,
                                         unsigned long size)
 {
        return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
 }
-static inline void *ioremap_fullcache(unsigned long physaddr,
+static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
                                      unsigned long size)
 {
        return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
index 127ad190cf2d6e895dd8c2d4990c750a1b6b94bd..325c86f8512d08b50e9dd9e3ed049c1bd975b93a 100644 (file)
 #define NR_IRQS (24+SYS_IRQS)
 #endif
 
+/*
+ * The hardirq mask has to be large enough to have
+ * space for potentially all IRQ sources in the system
+ * nesting on a single CPU:
+ */
+#if (1 << HARDIRQ_BITS) < NR_IRQS
+# error HARDIRQ_BITS is too low!
+#endif
+
 /*
  * Interrupt source definitions
  * General interrupt sources are the level 1-7.
index a0dd5c47002c9ef43705e80b09344318382e4db3..7d3fee342369e7c169bd7af227ffe2118da36044 100644 (file)
@@ -34,7 +34,6 @@ extern void (*mach_power_off)( void );
 extern unsigned long (*mach_hd_init) (unsigned long, unsigned long);
 extern void (*mach_hd_setup)(char *, int *);
 extern long mach_max_dma_address;
-extern void (*mach_floppy_setup)(char *, int *);
 extern void (*mach_heartbeat) (int);
 extern void (*mach_l2_flush) (int);
 extern void (*mach_beep) (unsigned int, unsigned int);
index 041f0a87b25daae492af9f50976bff1948a7a850..5439bcaa57c6476f39b24b61d66f52611e6873db 100644 (file)
@@ -19,9 +19,9 @@
 #define IOMAP_NOCACHE_NONSER           2
 #define IOMAP_WRITETHROUGH             3
 
-extern void iounmap(void *addr);
+extern void iounmap(void __iomem *addr);
 
-extern void *__ioremap(unsigned long physaddr, unsigned long size,
+extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
                       int cacheflag);
 extern void __iounmap(void *addr, unsigned long size);
 
@@ -30,21 +30,21 @@ extern void __iounmap(void *addr, unsigned long size);
  * two accesses to memory, which may be undesirable for some devices.
  */
 #define in_8(addr) \
-    ({ u8 __v = (*(volatile u8 *) (addr)); __v; })
+    ({ u8 __v = (*(__force volatile u8 *) (addr)); __v; })
 #define in_be16(addr) \
-    ({ u16 __v = (*(volatile u16 *) (addr)); __v; })
+    ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; })
 #define in_be32(addr) \
-    ({ u32 __v = (*(volatile u32 *) (addr)); __v; })
+    ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; })
 #define in_le16(addr) \
-    ({ u16 __v = le16_to_cpu(*(volatile u16 *) (addr)); __v; })
+    ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; })
 #define in_le32(addr) \
-    ({ u32 __v = le32_to_cpu(*(volatile u32 *) (addr)); __v; })
+    ({ u32 __v = le32_to_cpu(*(__force volatile u32 *) (addr)); __v; })
 
-#define out_8(addr,b) (void)((*(volatile u8 *) (addr)) = (b))
-#define out_be16(addr,w) (void)((*(volatile u16 *) (addr)) = (w))
-#define out_be32(addr,l) (void)((*(volatile u32 *) (addr)) = (l))
-#define out_le16(addr,w) (void)((*(volatile u16 *) (addr)) = cpu_to_le16(w))
-#define out_le32(addr,l) (void)((*(volatile u32 *) (addr)) = cpu_to_le32(l))
+#define out_8(addr,b) (void)((*(__force volatile u8 *) (addr)) = (b))
+#define out_be16(addr,w) (void)((*(__force volatile u16 *) (addr)) = (w))
+#define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l))
+#define out_le16(addr,w) (void)((*(__force volatile u16 *) (addr)) = cpu_to_le16(w))
+#define out_le32(addr,l) (void)((*(__force volatile u32 *) (addr)) = cpu_to_le32(l))
 
 #define raw_inb in_8
 #define raw_inw in_be16
@@ -54,7 +54,7 @@ extern void __iounmap(void *addr, unsigned long size);
 #define raw_outw(val,port) out_be16((port),(val))
 #define raw_outl(val,port) out_be32((port),(val))
 
-static inline void raw_insb(volatile u8 *port, u8 *buf, unsigned int len)
+static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len)
 {
        unsigned int i;
 
@@ -62,7 +62,7 @@ static inline void raw_insb(volatile u8 *port, u8 *buf, unsigned int len)
                *buf++ = in_8(port);
 }
 
-static inline void raw_outsb(volatile u8 *port, const u8 *buf,
+static inline void raw_outsb(volatile u8 __iomem *port, const u8 *buf,
                             unsigned int len)
 {
        unsigned int i;
@@ -71,7 +71,7 @@ static inline void raw_outsb(volatile u8 *port, const u8 *buf,
                out_8(port, *buf++);
 }
 
-static inline void raw_insw(volatile u16 *port, u16 *buf, unsigned int nr)
+static inline void raw_insw(volatile u16 __iomem *port, u16 *buf, unsigned int nr)
 {
        unsigned int tmp;
 
@@ -110,7 +110,7 @@ static inline void raw_insw(volatile u16 *port, u16 *buf, unsigned int nr)
        }
 }
 
-static inline void raw_outsw(volatile u16 *port, const u16 *buf,
+static inline void raw_outsw(volatile u16 __iomem *port, const u16 *buf,
                             unsigned int nr)
 {
        unsigned int tmp;
@@ -150,7 +150,7 @@ static inline void raw_outsw(volatile u16 *port, const u16 *buf,
        }
 }
 
-static inline void raw_insl(volatile u32 *port, u32 *buf, unsigned int nr)
+static inline void raw_insl(volatile u32 __iomem *port, u32 *buf, unsigned int nr)
 {
        unsigned int tmp;
 
@@ -189,7 +189,7 @@ static inline void raw_insl(volatile u32 *port, u32 *buf, unsigned int nr)
        }
 }
 
-static inline void raw_outsl(volatile u32 *port, const u32 *buf,
+static inline void raw_outsl(volatile u32 __iomem *port, const u32 *buf,
                             unsigned int nr)
 {
        unsigned int tmp;
@@ -230,7 +230,7 @@ static inline void raw_outsl(volatile u32 *port, const u32 *buf,
 }
 
 
-static inline void raw_insw_swapw(volatile u16 *port, u16 *buf,
+static inline void raw_insw_swapw(volatile u16 __iomem *port, u16 *buf,
                                  unsigned int nr)
 {
     if ((nr) % 8)
@@ -283,7 +283,7 @@ static inline void raw_insw_swapw(volatile u16 *port, u16 *buf,
                : "d0", "a0", "a1", "d6");
 }
 
-static inline void raw_outsw_swapw(volatile u16 *port, const u16 *buf,
+static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf,
                                   unsigned int nr)
 {
     if ((nr) % 8)
index a0cdf908237244d598f2a63104822ea5bba3bb51..b7b7ea20caaba7097438391491de756cad26bbc4 100644 (file)
@@ -144,7 +144,7 @@ struct sigaction {
 #endif /* __KERNEL__ */
 
 typedef struct sigaltstack {
-       void *ss_sp;
+       void __user *ss_sp;
        int ss_flags;
        size_t ss_size;
 } stack_t;
index e974bb072047b2fa9e0072f59da5ba729fb3aed5..5156a28a18d82a722fb9b92879d6c5c413cfeb90 100644 (file)
@@ -211,7 +211,7 @@ static inline unsigned long pte_to_pgoff(pte_t pte)
        return pte.pte & SUN3_PAGE_PGNUM_MASK;
 }
 
-static inline pte_t pgoff_to_pte(inline unsigned off)
+static inline pte_t pgoff_to_pte(unsigned off)
 {
        pte_t pte = { off + SUN3_PAGE_ACCESSED };
        return pte;
index fd838eb14213298e72087e2db892064449599705..bd038fccb64b8c7f6dbb85b545cff2375000074d 100644 (file)
@@ -31,7 +31,6 @@ int sun3_request_irq(unsigned int irq,
                    );
 extern void sun3_init_IRQ (void);
 extern irqreturn_t (*sun3_default_handler[]) (int, void *, struct pt_regs *);
-extern irqreturn_t (*sun3_inthandler[]) (int, void *, struct pt_regs *);
 extern void sun3_free_irq (unsigned int irq, void *dev_id);
 extern void sun3_enable_interrupts (void);
 extern void sun3_disable_interrupts (void);
index fda1eccf10aa0a27f56797487d5ec20cd1e3206a..98a9f79dab29b0c6288cae4fd10e2a9db0355c87 100644 (file)
@@ -208,7 +208,7 @@ static int sun3xflop_request_irq(void)
 
        if(!once) {
                once = 1;
-               error = request_irq(FLOPPY_IRQ, sun3xflop_hardint, SA_INTERRUPT, "floppy", 0);
+               error = request_irq(FLOPPY_IRQ, sun3xflop_hardint, SA_INTERRUPT, "floppy", NULL);
                return ((error == 0) ? 0 : -1);
        } else return 0;
 }
@@ -238,7 +238,7 @@ static int sun3xflop_init(void)
        *sun3x_fdc.fcr_r = 0;
 
        /* Success... */
-       floppy_set_flags(0, 1, FD_BROKEN_DCL); // I don't know how to detect this.
+       floppy_set_flags(NULL, 1, FD_BROKEN_DCL); // I don't know how to detect this.
        allowed_drive_mask = 0x01;
        return (int) SUN3X_FDC;
 }
index 9532ca3c45cbea08906689234ad6a3e0f6224515..c4d622a57dfbf5d3bfb9913bfa257bc8c0ab58da 100644 (file)
@@ -37,6 +37,7 @@ struct thread_info {
 #define init_stack             (init_thread_union.stack)
 
 #define task_thread_info(tsk)  (&(tsk)->thread.info)
+#define task_stack_page(tsk)   ((void *)(tsk)->thread_info)
 #define current_thread_info()  task_thread_info(current)
 
 #define __HAVE_THREAD_FUNCTIONS
index f5cedf19cf682c51349cd4b0856162ad0d6a1bf0..2ffd87b0a7694894547e5672655339c3062af058 100644 (file)
@@ -42,6 +42,7 @@ struct exception_table_entry
 ({                                                     \
     int __pu_err;                                      \
     typeof(*(ptr)) __pu_val = (x);                     \
+    __chk_user_ptr(ptr);                               \
     switch (sizeof (*(ptr))) {                         \
     case 1:                                            \
        __put_user_asm(__pu_err, __pu_val, ptr, b);     \
@@ -91,6 +92,7 @@ __asm__ __volatile__                                  \
 ({                                                             \
     int __gu_err;                                              \
     typeof(*(ptr)) __gu_val;                                   \
+    __chk_user_ptr(ptr);                                       \
     switch (sizeof(*(ptr))) {                                  \
     case 1:                                                    \
        __get_user_asm(__gu_err, __gu_val, ptr, b, "=d");       \
@@ -105,7 +107,7 @@ __asm__ __volatile__                                        \
         __gu_err = __constant_copy_from_user(&__gu_val, ptr, 8);  \
         break;                                                  \
     default:                                                   \
-       __gu_val = 0;                                           \
+       __gu_val = (typeof(*(ptr)))0;                           \
        __gu_err = __get_user_bad();                            \
        break;                                                  \
     }                                                          \
@@ -134,7 +136,7 @@ __asm__ __volatile__                                \
      : "m"(*(ptr)), "i" (-EFAULT), "0"(0))
 
 static inline unsigned long
-__generic_copy_from_user(void *to, const void *from, unsigned long n)
+__generic_copy_from_user(void *to, const void __user *from, unsigned long n)
 {
     unsigned long tmp;
     __asm__ __volatile__
@@ -189,7 +191,7 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n)
 }
 
 static inline unsigned long
-__generic_copy_to_user(void *to, const void *from, unsigned long n)
+__generic_copy_to_user(void __user *to, const void *from, unsigned long n)
 {
     unsigned long tmp;
     __asm__ __volatile__
@@ -264,7 +266,7 @@ __generic_copy_to_user(void *to, const void *from, unsigned long n)
         : "d0", "memory")
 
 static inline unsigned long
-__constant_copy_from_user(void *to, const void *from, unsigned long n)
+__constant_copy_from_user(void *to, const void __user *from, unsigned long n)
 {
     switch (n) {
     case 0:
@@ -520,7 +522,7 @@ __constant_copy_from_user(void *to, const void *from, unsigned long n)
 #define __copy_from_user_inatomic __copy_from_user
 
 static inline unsigned long
-__constant_copy_to_user(void *to, const void *from, unsigned long n)
+__constant_copy_to_user(void __user *to, const void *from, unsigned long n)
 {
     switch (n) {
     case 0:
@@ -766,7 +768,7 @@ __constant_copy_to_user(void *to, const void *from, unsigned long n)
  */
 
 static inline long
-strncpy_from_user(char *dst, const char *src, long count)
+strncpy_from_user(char *dst, const char __user *src, long count)
 {
     long res;
     if (count == 0) return count;
@@ -799,11 +801,11 @@ strncpy_from_user(char *dst, const char *src, long count)
  *
  * Return 0 on exception, a value greater than N if too long
  */
-static inline long strnlen_user(const char *src, long n)
+static inline long strnlen_user(const char __user *src, long n)
 {
        long res;
 
-       res = -(long)src;
+       res = -(unsigned long)src;
        __asm__ __volatile__
                ("1:\n"
                 "   tstl %2\n"
@@ -842,7 +844,7 @@ static inline long strnlen_user(const char *src, long n)
  */
 
 static inline unsigned long
-clear_user(void *to, unsigned long n)
+clear_user(void __user *to, unsigned long n)
 {
     __asm__ __volatile__
        ("   tstl %1\n"
index cf816588bedb9300fcd968aa5b1bf83c6ffbd4ec..5ce97c22b582e316aac672db4887ee8486aa239d 100644 (file)
 #define z_memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
 #define z_memcpy_toio(a,b,c)   memcpy((void *)(a),(b),(c))
 
-static inline void *z_remap_nocache_ser(unsigned long physaddr,
+static inline void __iomem *z_remap_nocache_ser(unsigned long physaddr,
                                        unsigned long size)
 {
        return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
 }
 
-static inline void *z_remap_nocache_nonser(unsigned long physaddr,
+static inline void __iomem *z_remap_nocache_nonser(unsigned long physaddr,
                                           unsigned long size)
 {
        return __ioremap(physaddr, size, IOMAP_NOCACHE_NONSER);
 }
 
-static inline void *z_remap_writethrough(unsigned long physaddr,
+static inline void __iomem *z_remap_writethrough(unsigned long physaddr,
                                         unsigned long size)
 {
        return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
 }
-static inline void *z_remap_fullcache(unsigned long physaddr,
+static inline void __iomem *z_remap_fullcache(unsigned long physaddr,
                                      unsigned long size)
 {
        return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
index 5a9f9c297f79f1c122c6c83b41f11e967017dbf6..27c90afd3339cfc29054635bcf301dfe180e259e 100644 (file)
@@ -38,7 +38,6 @@ extern void (*mach_power_off)( void );
 extern unsigned long (*mach_hd_init) (unsigned long, unsigned long);
 extern void (*mach_hd_setup)(char *, int *);
 extern long mach_max_dma_address;
-extern void (*mach_floppy_setup)(char *, int *);
 extern void (*mach_floppy_eject)(void);
 extern void (*mach_heartbeat) (int);
 extern void (*mach_l2_flush) (int);
index 7b9a3fa3af5d1bd45809958c8b809eb474ea6bbb..b8f009edf2b2cf5a2c88c756a7e3151f68a8e6e9 100644 (file)
@@ -75,8 +75,6 @@ static inline struct thread_info *current_thread_info(void)
 #define alloc_thread_info(tsk) ((struct thread_info *) \
                                __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
 #define free_thread_info(ti)   free_pages((unsigned long) (ti), THREAD_SIZE_ORDER)
-#define get_thread_info(ti)    get_task_struct((ti)->task)
-#define put_thread_info(ti)    put_task_struct((ti)->task)
 #endif /* __ASSEMBLY__ */
 
 #define        PREEMPT_ACTIVE  0x4000000
index 82141c711c338ad5a64c9cef3009b0e99205e208..59d26b52ba321af8775bfee6edcb9de3191f1252 100644 (file)
@@ -27,7 +27,6 @@ extern unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
        .max_interval           = 32,                   \
        .busy_factor            = 32,                   \
        .imbalance_pct          = 125,                  \
-       .cache_hot_time         = (10*1000),            \
        .cache_nice_tries       = 1,                    \
        .per_cpu_gain           = 100,                  \
        .flags                  = SD_LOAD_BALANCE       \
index de53055a62aea78884d5de09f52a4fa5829bc8cd..39d2bd50fecede26d52090657e08b5fe71e29f39 100644 (file)
@@ -200,11 +200,11 @@ extern void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long
 
 unsigned long get_wchan(struct task_struct *p);
 
-#define __PT_REG(reg) ((long)&((struct pt_regs *)0)->reg - sizeof(struct pt_regs))
-#define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32)
-#define KSTK_EIP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_epc)))
-#define KSTK_ESP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(regs[29])))
-#define KSTK_STATUS(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_status)))
+#define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
+#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
+#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
+#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
+#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
 
 #define cpu_relax()    barrier()
 
index 330c4e497af38d248d3ff5e6a8ff584040ffd6f1..e8e5d414337797bf9e20f0db7006ada9f7b6e533 100644 (file)
@@ -159,11 +159,21 @@ struct task_struct;
 do {                                                                   \
        if (cpu_has_dsp)                                                \
                __save_dsp(prev);                                       \
-       (last) = resume(prev, next, next->thread_info);                 \
+       (last) = resume(prev, next, task_thread_info(next));            \
        if (cpu_has_dsp)                                                \
                __restore_dsp(current);                                 \
 } while(0)
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
 {
        __u32 retval;
index e6c24472e03fa64ffd95837137b0528e12083df5..1612b3fe10801471ee0f4f1c6d19fed91c1c3934 100644 (file)
@@ -97,8 +97,6 @@ register struct thread_info *__current_thread_info __asm__("$28");
 #endif
 
 #define free_thread_info(info) kfree(info)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #endif /* !__ASSEMBLY__ */
 
index f3928d3a80cb01b2afd25569a59fd37e178a4576..a5a973c0c07f55f272d4fccd7c6587f516afff84 100644 (file)
@@ -49,6 +49,15 @@ extern struct task_struct *_switch_to(struct task_struct *, struct task_struct *
        (last) = _switch_to(prev, next);                        \
 } while(0)
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
 
 
 /* interrupt control */
index 57bbb76cb6c1db66000b11f48bddc4309f991b18..ac32f140b83aa1135259d63d615eb4baf4eafdac 100644 (file)
@@ -43,9 +43,6 @@ struct thread_info {
 #define alloc_thread_info(tsk) ((struct thread_info *) \
                        __get_free_pages(GFP_KERNEL, THREAD_ORDER))
 #define free_thread_info(ti)    free_pages((unsigned long) (ti), THREAD_ORDER)
-#define get_thread_info(ti)     get_task_struct((ti)->task)
-#define put_thread_info(ti)     put_task_struct((ti)->task)
-
 
 /* how to get the thread information struct from C */
 #define current_thread_info()  ((struct thread_info *)mfctl(30))
index 3ae52d9dc9ff16ed37c79121e55c836a02a19d82..a64b4d425dab3c4b6041422464da182ed3713009 100644 (file)
@@ -65,6 +65,7 @@ struct paca_struct {
        u64 stab_real;                  /* Absolute address of segment table */
        u64 stab_addr;                  /* Virtual address of segment table */
        void *emergency_sp;             /* pointer to emergency stack */
+       u64 data_offset;                /* per cpu data offset */
        s16 hw_cpu_id;                  /* Physical processor number */
        u8 cpu_start;                   /* At startup, processor spins until */
                                        /* this becomes non-zero. */
index 76d7cb4b4ffc3f63ec140ccc0740c810b9ac15a3..0b82df483f7f2f79c6d05dc9ae7a92e85001c81f 100644 (file)
@@ -178,7 +178,7 @@ typedef unsigned long pmd_t;
 #define pmd_val(x)     (x)
 #define __pmd(x)       (x)
 
-#ifndef CONFIG_PPC_64K_PAGES
+#if defined(CONFIG_PPC64) && !defined(CONFIG_PPC_64K_PAGES)
 typedef unsigned long pud_t;
 #define pud_val(x)     (x)
 #define __pud(x)       (x)
index 897e49a88a6b091dde6d8910d0553adf8578887e..3fca21ddf546c4213f863bffa8cf7790d612e516 100644 (file)
 #define _ASM_POWERPC_PARPORT_H
 #ifdef __KERNEL__
 
-static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma);
+#include <asm/prom.h>
+
+extern struct parport *parport_pc_probe_port (unsigned long int base,
+                                              unsigned long int base_hi,
+                                              int irq, int dma,
+                                              struct pci_dev *dev);
+
 static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
 {
-       return parport_pc_find_isa_ports (autoirq, autodma);
+       struct device_node *np;
+       u32 *prop;
+       u32 io1, io2;
+       int propsize;
+       int count = 0;
+       for (np = NULL; (np = of_find_compatible_node(np,
+                                                     "parallel",
+                                                     "pnpPNP,400")) != NULL;) {
+               prop = (u32 *)get_property(np, "reg", &propsize);
+               if (!prop || propsize > 6*sizeof(u32))
+                       continue;
+               io1 = prop[1]; io2 = prop[2];
+               prop = (u32 *)get_property(np, "interrupts", NULL);
+               if (!prop)
+                       continue;
+               if (parport_pc_probe_port(io1, io2, prop[0], autodma, NULL) != NULL)
+                       count++;
+       }
+       return count;
 }
 
 #endif /* __KERNEL__ */
index 06a959d67234789754963cbb40d1f7e6e4c25188..e31922c50e53473c5d340348e190cbf1ebe788d1 100644 (file)
@@ -1 +1,57 @@
+#ifndef _ASM_POWERPC_PERCPU_H_
+#define _ASM_POWERPC_PERCPU_H_
+#ifdef __powerpc64__
+#include <linux/compiler.h>
+
+/*
+ * Same as asm-generic/percpu.h, except that we store the per cpu offset
+ * in the paca. Based on the x86-64 implementation.
+ */
+
+#ifdef CONFIG_SMP
+
+#include <asm/paca.h>
+
+#define __per_cpu_offset(cpu) (paca[cpu].data_offset)
+#define __my_cpu_offset() get_paca()->data_offset
+
+/* Separate out the type, so (int[3], foo) works. */
+#define DEFINE_PER_CPU(type, name) \
+    __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
+
+/* var is in discarded region: offset to particular copy we want */
+#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
+#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
+
+/* A macro to avoid #include hell... */
+#define percpu_modcopy(pcpudst, src, size)                     \
+do {                                                           \
+       unsigned int __i;                                       \
+       for (__i = 0; __i < NR_CPUS; __i++)                     \
+               if (cpu_possible(__i))                          \
+                       memcpy((pcpudst)+__per_cpu_offset(__i), \
+                              (src), (size));                  \
+} while (0)
+
+extern void setup_per_cpu_areas(void);
+
+#else /* ! SMP */
+
+#define DEFINE_PER_CPU(type, name) \
+    __typeof__(type) per_cpu__##name
+
+#define per_cpu(var, cpu)                      (*((void)(cpu), &per_cpu__##var))
+#define __get_cpu_var(var)                     per_cpu__##var
+
+#endif /* SMP */
+
+#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
+
+#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
+#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
+
+#else
 #include <asm-generic/percpu.h>
+#endif
+
+#endif /* _ASM_POWERPC_PERCPU_H_ */
index 3428889e27b78f04ae563ca47edda4e12f2b8e1e..f43c6835e62a1911c5a18205c0a86a0599e33297 100644 (file)
@@ -161,7 +161,6 @@ extern struct rtas_t rtas;
 extern void enter_rtas(unsigned long);
 extern int rtas_token(const char *service);
 extern int rtas_call(int token, int, int, int *, ...);
-extern void call_rtas_display_status(unsigned char);
 extern void rtas_restart(char *cmd);
 extern void rtas_power_off(void);
 extern void rtas_halt(void);
index 0c58e32a9570525ec4a2f036413d4cabfa69c10d..1be629b4fb97bfaa23fa95867bb483366109ee7e 100644 (file)
@@ -175,6 +175,16 @@ struct thread_struct;
 extern struct task_struct *_switch(struct thread_struct *prev,
                                   struct thread_struct *next);
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 extern unsigned int rtas_data;
 extern int mem_init_done;      /* set on boot once kmalloc can be called */
 extern unsigned long memory_limit;
index ac1e80e6033ee13c22b4a8cc4ce1aa806e173582..7e09d7cda933c2919d16c51adcec0d30f24d39ad 100644 (file)
@@ -89,9 +89,6 @@ struct thread_info {
 
 #endif /* THREAD_SHIFT < PAGE_SHIFT */
 
-#define get_thread_info(ti)    get_task_struct((ti)->task)
-#define put_thread_info(ti)    put_task_struct((ti)->task)
-
 /* how to get the thread information struct from C */
 static inline struct thread_info *current_thread_info(void)
 {
index 9f3d4da261c478876f27352ce1d925de35427323..1e19cd00af25856445a44912051964b1fe456671 100644 (file)
@@ -39,7 +39,6 @@ static inline int node_to_first_cpu(int node)
        .max_interval           = 32,                   \
        .busy_factor            = 32,                   \
        .imbalance_pct          = 125,                  \
-       .cache_hot_time         = (10*1000000),         \
        .cache_nice_tries       = 1,                    \
        .per_cpu_gain           = 100,                  \
        .busy_idx               = 3,                    \
index 479f2d8ff74a9d2bcf52b999c4fa9594935c5e85..5c4236c342bb162f1f5e8b46c8e657e9281b0a17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * c 2001 PPC 64 Team, IBM Corp
+ * (c) 2001, 2006 IBM Corporation.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -36,5 +36,12 @@ extern void udbg_scc_init(int force_scc);
 extern int udbg_adb_init(int force_btext);
 extern void udbg_adb_init_early(void);
 
+extern void __init udbg_early_init(void);
+extern void __init udbg_init_debug_lpar(void);
+extern void __init udbg_init_pmac_realmode(void);
+extern void __init udbg_init_maple_realmode(void);
+extern void __init udbg_init_iseries(void);
+extern void __init udbg_init_rtas(void);
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_UDBG_H */
index bd99cb53a19fb512b024e6a184f8f7b3359102ea..212dca66fcac28f7a38fb994149997c58be6e0c5 100644 (file)
@@ -123,6 +123,16 @@ extern struct task_struct *__switch_to(struct task_struct *,
        struct task_struct *);
 #define switch_to(prev, next, last)    ((last) = __switch_to((prev), (next)))
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 struct thread_struct;
 extern struct task_struct *_switch(struct thread_struct *prev,
                                   struct thread_struct *next);
index 372d51cccd5306a46494744898132a4929551c19..710646e64f7d6e4a062596d0796d0eb7b19c1a6a 100644 (file)
@@ -163,7 +163,7 @@ static inline int dump_regs(struct pt_regs *ptregs, elf_gregset_t *regs)
 
 static inline int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
 {
-       struct pt_regs *ptregs = __KSTK_PTREGS(tsk);
+       struct pt_regs *ptregs = task_pt_regs(tsk);
        memcpy(&regs->psw, &ptregs->psw, sizeof(regs->psw)+sizeof(regs->gprs));
        memcpy(regs->acrs, tsk->thread.acrs, sizeof(regs->acrs));
        regs->orig_gpr2 = ptregs->orig_gpr2;
index 4ec652ebb3b1910bb80d80c4926080eb49216244..c5cbc4bd8414e12c571982cb5c5d0f85bec31406 100644 (file)
@@ -191,10 +191,10 @@ extern void show_registers(struct pt_regs *regs);
 extern void show_trace(struct task_struct *task, unsigned long *sp);
 
 unsigned long get_wchan(struct task_struct *p);
-#define __KSTK_PTREGS(tsk) ((struct pt_regs *) \
-        ((unsigned long) tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs)))
-#define KSTK_EIP(tsk)  (__KSTK_PTREGS(tsk)->psw.addr)
-#define KSTK_ESP(tsk)  (__KSTK_PTREGS(tsk)->gprs[15])
+#define task_pt_regs(tsk) ((struct pt_regs *) \
+        (task_stack_page(tsk) + THREAD_SIZE) - 1)
+#define KSTK_EIP(tsk)  (task_pt_regs(tsk)->psw.addr)
+#define KSTK_ESP(tsk)  (task_pt_regs(tsk)->gprs[15])
 
 /*
  * Give up the time slice of the virtual PU.
index 864cae7e1fd66382ae919b96ebe781f05fd237e5..c7c3a9ad593f49682a35f3c7cb0d2a28a952cf17 100644 (file)
@@ -104,6 +104,16 @@ static inline void restore_access_regs(unsigned int *acrs)
        prev = __switch_to(prev,next);                                       \
 } while (0)
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
 extern void account_user_vtime(struct task_struct *);
 extern void account_system_vtime(struct task_struct *);
index 6c18a3f24316ad69defc3f680edefe695702fca7..f3797a52c4ea5e06d5bca508c14706123ecd116e 100644 (file)
@@ -81,8 +81,6 @@ static inline struct thread_info *current_thread_info(void)
 #define alloc_thread_info(tsk) ((struct thread_info *) \
        __get_free_pages(GFP_KERNEL,THREAD_ORDER))
 #define free_thread_info(ti) free_pages((unsigned long) (ti),THREAD_ORDER)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #endif
 
index 0f75e16a74150ec04eabc711c702fc2d12436fc6..792fc35bd6245c8551909a6dbf57b385b761fea6 100644 (file)
@@ -91,6 +91,16 @@ struct pt_dspregs {
 #define instruction_pointer(regs) ((regs)->pc)
 extern void show_regs(struct pt_regs *);
 
+#ifdef CONFIG_SH_DSP
+#define task_pt_regs(task) \
+       ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
+                - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
+#else
+#define task_pt_regs(task) \
+       ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
+                - sizeof(unsigned long)) - 1)
+#endif
+
 static inline unsigned long profile_pc(struct pt_regs *regs)
 {
        unsigned long pc = instruction_pointer(regs);
index 28a3c2d8bcd7c132afb75f87b16d7a684678500d..bb0330499bdfef3987cc88d7dd454ead0df3a929 100644 (file)
        last = __last;                                                  \
 } while (0)
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 #define nop() __asm__ __volatile__ ("nop")
 
 
index 46080cefaff896d12e867f76976e7894b84b88fa..85f0c11b4319e111a6135e5e20c4a0c301e7cac1 100644 (file)
@@ -60,8 +60,6 @@ static inline struct thread_info *current_thread_info(void)
 #define THREAD_SIZE (2*PAGE_SIZE)
 #define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #else /* !__ASSEMBLY__ */
 
index 10f024c6a2e3724b02982a162080eb0402979cdc..1f825cb163c3295756d13b4529b1147e4c77f2a7 100644 (file)
@@ -66,8 +66,6 @@ static inline struct thread_info *current_thread_info(void)
 
 #define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #endif /* __ASSEMBLY__ */
 
index 1f6b71f9e1b637f9c773e26db22dbc26e690402d..58dd162927bbdd076ff1f6c11a80fadcdb68b324 100644 (file)
@@ -155,7 +155,7 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
        "here:\n"                                                                       \
         : "=&r" (last)                                                                 \
         : "r" (&(current_set[hard_smp_processor_id()])),       \
-         "r" ((next)->thread_info),                            \
+         "r" (task_thread_info(next)),                         \
          "i" (TI_KPSR),                                        \
          "i" (TI_KSP),                                         \
          "i" (TI_TASK)                                         \
@@ -165,6 +165,16 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
          "o0", "o1", "o2", "o3",                   "o7");      \
        } while(0)
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 /*
  * Changing the IRQ level on the Sparc.
  */
index ff6ccb3d24c6121bb1c1da217ee3075f3da033a2..65f060b040abdabab9c9a1efa12001ba60ff804d 100644 (file)
@@ -92,9 +92,6 @@ BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void)
 BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
 #define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti)
 
-#define get_thread_info(ti)    get_task_struct((ti)->task)
-#define put_thread_info(ti)    put_task_struct((ti)->task)
-
 #endif /* __ASSEMBLY__ */
 
 /*
index 91458118277e4decbf19f2f7445563d7354a7cb7..69539a8ab833d4645eaab4ccd2536357af2540d9 100644 (file)
@@ -119,7 +119,7 @@ typedef struct {
 #endif
 
 #define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs)     \
-       ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread_info->kregs); 1; })
+       ({ ELF_CORE_COPY_REGS((*(__elf_regs)), task_pt_regs(__tsk)); 1; })
 
 /*
  * This is used to ensure we don't load something for the wrong architecture.
index 08ba72d7722c9c4be4fe7d96eb534ceb75d968c4..57ee7b3061897d9810593b53d0c66eabe3b414ce 100644 (file)
@@ -60,7 +60,7 @@ do { \
        register unsigned long pgd_cache asm("o4"); \
        paddr = __pa((__mm)->pgd); \
        pgd_cache = 0UL; \
-       if ((__tsk)->thread_info->flags & _TIF_32BIT) \
+       if (task_thread_info(__tsk)->flags & _TIF_32BIT) \
                pgd_cache = get_pgd_cache((__mm)->pgd); \
        __asm__ __volatile__("wrpr      %%g0, 0x494, %%pstate\n\t" \
                             "mov       %3, %%g4\n\t" \
index 3169f3e2237efb91769521f0b66a9b898d7df060..cd8d9b4c86587073821ab5144cec09803a5fcaa5 100644 (file)
@@ -186,8 +186,9 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
 extern unsigned long get_wchan(struct task_struct *task);
 
-#define KSTK_EIP(tsk)  ((tsk)->thread_info->kregs->tpc)
-#define KSTK_ESP(tsk)  ((tsk)->thread_info->kregs->u_regs[UREG_FP])
+#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)
+#define KSTK_EIP(tsk)  (task_pt_regs(tsk)->tpc)
+#define KSTK_ESP(tsk)  (task_pt_regs(tsk)->u_regs[UREG_FP])
 
 #define cpu_relax()    barrier()
 
index 309f1466b6fa1125edd34f933aa56ab645dc76b0..af254e5818348095aa62c841ede600765a4a9065 100644 (file)
@@ -208,7 +208,7 @@ do {        if (test_thread_flag(TIF_PERFCTR)) {                            \
        /* If you are tempted to conditionalize the following */        \
        /* so that ASI is only written if it changes, think again. */   \
        __asm__ __volatile__("wr %%g0, %0, %%asi"                       \
-       : : "r" (__thread_flag_byte_ptr(next->thread_info)[TI_FLAG_BYTE_CURRENT_DS]));\
+       : : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\
        __asm__ __volatile__(                                           \
        "mov    %%g4, %%g7\n\t"                                         \
        "wrpr   %%g0, 0x95, %%pstate\n\t"                               \
@@ -238,7 +238,7 @@ do {        if (test_thread_flag(TIF_PERFCTR)) {                            \
        "b,a ret_from_syscall\n\t"                                      \
        "1:\n\t"                                                        \
        : "=&r" (last)                                                  \
-       : "0" (next->thread_info),                                      \
+       : "0" (task_thread_info(next)),                                 \
          "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD),            \
          "i" (TI_CWP), "i" (TI_TASK)                                   \
        : "cc",                                                         \
@@ -253,6 +253,16 @@ do {       if (test_thread_flag(TIF_PERFCTR)) {                            \
        }                                                               \
 } while(0)
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ *
+ * TODO: fill this in!
+ */
+static inline void sched_cacheflush(void)
+{
+}
+
 static inline unsigned long xchg32(__volatile__ unsigned int *m, unsigned int val)
 {
        unsigned long tmp1, tmp2;
index 97267f059ef5317a4c629383992cc3a3642bb2be..705c71972c326ed5057e1683cc2e02a9e0ca0262 100644 (file)
@@ -56,9 +56,6 @@ static inline struct thread_info *current_thread_info(void)
        ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL))
 #define free_thread_info(ti) kfree(ti)
 
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
-
 #endif
 
 #define PREEMPT_ACTIVE         0x10000000
index 98f929427d3dcfde6e8a825ba0f7620f3743511d..2d31308935a00ab0263feab4b75ce8be482724be 100644 (file)
@@ -98,10 +98,10 @@ unsigned long get_wchan (struct task_struct *p);
 
 
 /* Return some info about the user process TASK.  */
-#define task_tos(task) ((unsigned long)(task)->thread_info + THREAD_SIZE)
-#define task_regs(task) ((struct pt_regs *)task_tos (task) - 1)
-#define task_sp(task)  (task_regs (task)->gpr[GPR_SP])
-#define task_pc(task)  (task_regs (task)->pc)
+#define task_tos(task) ((unsigned long)task_stack_page(task) + THREAD_SIZE)
+#define task_pt_regs(task) ((struct pt_regs *)task_tos (task) - 1)
+#define task_sp(task)  (task_pt_regs (task)->gpr[GPR_SP])
+#define task_pc(task)  (task_pt_regs (task)->pc)
 /* Grotty old names for some.  */
 #define KSTK_EIP(task) task_pc (task)
 #define KSTK_ESP(task) task_sp (task)
index e4cfad94a5530f528834692346aa905fdf20bdc4..82b8f2846207519f7d4b0deb7380e857f27dffbc 100644 (file)
@@ -58,8 +58,6 @@ struct thread_info {
 #define alloc_thread_info(tsk) ((struct thread_info *) \
                                __get_free_pages(GFP_KERNEL, 1))
 #define free_thread_info(ti)   free_pages((unsigned long) (ti), 1)
-#define get_thread_info(ti)    get_task_struct((ti)->task)
-#define put_thread_info(ti)    put_task_struct((ti)->task)
 
 #endif /* __ASSEMBLY__ */
 
index 5647b7de1749a8589f677092e770c015f1d7fa8c..4f6a4dc455bb9e83fcc1e139561e8abf80a4c62b 100644 (file)
@@ -42,11 +42,6 @@ static __inline void apic_write(unsigned long reg, unsigned int v)
        *((volatile unsigned int *)(APIC_BASE+reg)) = v;
 }
 
-static __inline void apic_write_atomic(unsigned long reg, unsigned int v)
-{
-       xchg((volatile unsigned int *)(APIC_BASE+reg), v);
-}
-
 static __inline unsigned int apic_read(unsigned long reg)
 {
        return *((volatile unsigned int *)(APIC_BASE+reg));
@@ -57,10 +52,6 @@ static __inline__ void apic_wait_icr_idle(void)
        while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY );
 }
 
-#define FORCE_READ_AROUND_WRITE 0
-#define apic_read_around(x)
-#define apic_write_around(x,y) apic_write((x),(y))
-
 static inline void ack_APIC_irq(void)
 {
        /*
@@ -71,7 +62,7 @@ static inline void ack_APIC_irq(void)
         */
 
        /* Docs say use 0 for future compatibility */
-       apic_write_around(APIC_EOI, 0);
+       apic_write(APIC_EOI, 0);
 }
 
 extern int get_maxlvt (void);
@@ -113,6 +104,12 @@ extern int disable_timer_pin_1;
 
 extern void setup_threshold_lvt(unsigned long lvt_off);
 
+void smp_send_timer_broadcast_ipi(void);
+void switch_APIC_timer_to_ipi(void *cpumask);
+void switch_ipi_to_APIC_timer(void *cpumask);
+
+#define ARCH_APICTIMER_STOPS_ON_C3     1
+
 #endif /* CONFIG_X86_LOCAL_APIC */
 
 extern unsigned boot_cpu_id;
index fb1c99ac669fda16727616a5172aac3c44de2c51..decaa2d540e86b03dd4ae67e4dd3c1f851685c8e 100644 (file)
@@ -13,6 +13,7 @@
 #define                APIC_ID         0x20
 #define                        APIC_ID_MASK            (0xFFu<<24)
 #define                        GET_APIC_ID(x)          (((x)>>24)&0xFFu)
+#define                        SET_APIC_ID(x)          (((x)<<24))
 #define                APIC_LVR        0x30
 #define                        APIC_LVR_MASK           0xFF00FF
 #define                        GET_APIC_VERSION(x)     ((x)&0xFFu)
index 6b540237a2f805c7b94fbe2f002828ba50d21058..4b5cd553e772637d157b0af95edbd89d7e12eb1a 100644 (file)
@@ -2,6 +2,7 @@
 #define __ARCH_X86_64_ATOMIC__
 
 #include <linux/config.h>
+#include <asm/types.h>
 
 /* atomic_t should be 32 bit signed type */
 
index a4d5d090945347fd89d70a2c2555bdb7112c7e06..eb4df23e1e411c45c19d9de8d701b8fd30bcdfaa 100644 (file)
@@ -29,7 +29,7 @@ static __inline__ void set_bit(int nr, volatile void * addr)
 {
        __asm__ __volatile__( LOCK_PREFIX
                "btsl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"dIr" (nr) : "memory");
 }
 
@@ -46,7 +46,7 @@ static __inline__ void __set_bit(int nr, volatile void * addr)
 {
        __asm__ volatile(
                "btsl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"dIr" (nr) : "memory");
 }
 
@@ -64,7 +64,7 @@ static __inline__ void clear_bit(int nr, volatile void * addr)
 {
        __asm__ __volatile__( LOCK_PREFIX
                "btrl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"dIr" (nr));
 }
 
@@ -72,7 +72,7 @@ static __inline__ void __clear_bit(int nr, volatile void * addr)
 {
        __asm__ __volatile__(
                "btrl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"dIr" (nr));
 }
 
@@ -92,7 +92,7 @@ static __inline__ void __change_bit(int nr, volatile void * addr)
 {
        __asm__ __volatile__(
                "btcl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"dIr" (nr));
 }
 
@@ -109,7 +109,7 @@ static __inline__ void change_bit(int nr, volatile void * addr)
 {
        __asm__ __volatile__( LOCK_PREFIX
                "btcl %1,%0"
-               :"=m" (ADDR)
+               :"+m" (ADDR)
                :"dIr" (nr));
 }
 
@@ -127,7 +127,7 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
 
        __asm__ __volatile__( LOCK_PREFIX
                "btsl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"dIr" (nr) : "memory");
        return oldbit;
 }
@@ -147,7 +147,7 @@ static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
 
        __asm__(
                "btsl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"dIr" (nr));
        return oldbit;
 }
@@ -166,7 +166,7 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
 
        __asm__ __volatile__( LOCK_PREFIX
                "btrl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"dIr" (nr) : "memory");
        return oldbit;
 }
@@ -186,7 +186,7 @@ static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
 
        __asm__(
                "btrl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"dIr" (nr));
        return oldbit;
 }
@@ -198,7 +198,7 @@ static __inline__ int __test_and_change_bit(int nr, volatile void * addr)
 
        __asm__ __volatile__(
                "btcl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"dIr" (nr) : "memory");
        return oldbit;
 }
@@ -217,7 +217,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
 
        __asm__ __volatile__( LOCK_PREFIX
                "btcl %2,%1\n\tsbbl %0,%0"
-               :"=r" (oldbit),"=m" (ADDR)
+               :"=r" (oldbit),"+m" (ADDR)
                :"dIr" (nr) : "memory");
        return oldbit;
 }
@@ -396,6 +396,22 @@ static __inline__ int fls64(__u64 x)
        return __fls(x) + 1;
 }
 
+/**
+ * fls - find last bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as ffs.
+ */
+static __inline__ int fls(int x)
+{
+       int r;
+
+       __asm__("bsrl %1,%0\n\t"
+               "cmovzl %2,%0"
+               : "=&r" (r) : "rm" (x), "rm" (-1));
+       return r+1;
+}
+
 /**
  * hweightN - returns the hamming weight of a N-bit word
  * @x: the word to weigh
@@ -434,9 +450,6 @@ static __inline__ int fls64(__u64 x)
 #define minix_find_first_zero_bit(addr,size) \
        find_first_zero_bit((void*)addr,size)
 
-/* find last set bit */
-#define fls(x) generic_fls(x)
-
 #endif /* __KERNEL__ */
 
 #endif /* _X86_64_BITOPS_H */
index b4a2401de77b5824239f1ec8b38d9b578d839e68..263f0a211ed7b36880cba02eba00f8645e2054e5 100644 (file)
 #define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)
 #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
 
+#ifdef CONFIG_X86_VSMP
+
+/* vSMP Internode cacheline shift */
+#define INTERNODE_CACHE_SHIFT (12)
+#ifdef CONFIG_SMP
+#define __cacheline_aligned_in_smp                                     \
+       __attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT))))         \
+       __attribute__((__section__(".data.page_aligned")))
+#endif
+
+#endif
+
 #endif
index f0155c38f639056f6c4f812fb8ad5ab345e090d0..b37ab8218ef03634e90d5dd8d59b2546e088481c 100644 (file)
@@ -198,8 +198,13 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
 
 static __inline__ void __user *compat_alloc_user_space(long len)
 {
-       struct pt_regs *regs = (void *)current->thread.rsp0 - sizeof(struct pt_regs); 
+       struct pt_regs *regs = task_pt_regs(current);
        return (void __user *)regs->rsp - len; 
 }
 
+static inline int is_compat_task(void)
+{
+       return current_thread_info()->status & TS_COMPAT;
+}
+
 #endif /* _ASM_X86_64_COMPAT_H */
index aea308c6570942b0cb6b397e21c995bd7d9ac8c3..41c0ac8559be1733e9f3d27badd4e545f93f8ddc 100644 (file)
@@ -61,8 +61,9 @@
 #define X86_FEATURE_K6_MTRR    (3*32+ 1) /* AMD K6 nonstandard MTRRs */
 #define X86_FEATURE_CYRIX_ARR  (3*32+ 2) /* Cyrix ARRs (= MTRRs) */
 #define X86_FEATURE_CENTAUR_MCR        (3*32+ 3) /* Centaur MCRs (= MTRRs) */
-#define X86_FEATURE_K8_C       (3*32+ 4) /* C stepping K8 */
+/* 4 free */
 #define X86_FEATURE_CONSTANT_TSC (3*32+5) /* TSC runs at constant rate */
+#define X86_FEATURE_SYNC_RDTSC  (3*32+6)  /* RDTSC syncs CPU core */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3       (4*32+ 0) /* Streaming SIMD Extensions-3 */
index 33764869387bc1c5ad9a707df503e5eef0c8bedf..eb7723a467908b5f86cb0e2fc2dd24168c8e523d 100644 (file)
@@ -25,7 +25,7 @@ struct n_desc_struct {
        unsigned int a,b;
 };     
 
-extern struct desc_struct cpu_gdt_table[NR_CPUS][GDT_ENTRIES];
+extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
 
 enum { 
        GATE_INTERRUPT = 0xE, 
@@ -79,6 +79,9 @@ extern struct desc_struct default_ldt[];
 extern struct gate_struct idt_table[]; 
 extern struct desc_ptr cpu_gdt_descr[];
 
+/* the cpu gdt accessor */
+#define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address)
+
 static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist)  
 {
        struct gate_struct s;   
@@ -114,6 +117,11 @@ static inline void set_system_gate(int nr, void *func)
        _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, 0); 
 } 
 
+static inline void set_system_gate_ist(int nr, void *func, unsigned ist)
+{
+       _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist);
+}
+
 static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, 
                                         unsigned size) 
 { 
@@ -139,20 +147,20 @@ static inline void set_tss_desc(unsigned cpu, void *addr)
         * -1? seg base+limit should be pointing to the address of the
         * last valid byte
         */
-       set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_TSS],
+       set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_TSS],
                (unsigned long)addr, DESC_TSS,
                IO_BITMAP_OFFSET + IO_BITMAP_BYTES + sizeof(unsigned long) - 1);
 } 
 
 static inline void set_ldt_desc(unsigned cpu, void *addr, int size)
 { 
-       set_tssldt_descriptor(&cpu_gdt_table[cpu][GDT_ENTRY_LDT], (unsigned long)addr, 
+       set_tssldt_descriptor(&cpu_gdt(cpu)[GDT_ENTRY_LDT], (unsigned long)addr,
                              DESC_LDT, size * 8 - 1);
 }
 
 static inline void set_seg_base(unsigned cpu, int entry, void *base)
 { 
-       struct desc_struct *d = &cpu_gdt_table[cpu][entry];
+       struct desc_struct *d = &cpu_gdt(cpu)[entry];
        u32 addr = (u32)(u64)base;
        BUG_ON((u64)base >> 32); 
        d->base0 = addr & 0xffff;
@@ -194,7 +202,7 @@ static inline void set_seg_base(unsigned cpu, int entry, void *base)
 
 static inline void load_TLS(struct thread_struct *t, unsigned int cpu)
 {
-       u64 *gdt = (u64 *)(cpu_gdt_table[cpu] + GDT_ENTRY_TLS_MIN);
+       u64 *gdt = (u64 *)(cpu_gdt(cpu) + GDT_ENTRY_TLS_MIN);
        gdt[0] = t->tls_array[0];
        gdt[1] = t->tls_array[1];
        gdt[2] = t->tls_array[2];
index 36d16dfbac88d7e9b48cd6e254726571dd535650..49a81a66516e9ba2d6556c0154925d970d0ceaf8 100644 (file)
 #include <asm/io.h>
 #include <asm/swiotlb.h>
 
-extern dma_addr_t bad_dma_address;
-#define dma_mapping_error(x) \
-       (swiotlb ? swiotlb_dma_mapping_error(x) : ((x) == bad_dma_address))
-
-void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
-                        gfp_t gfp);
-void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
-                        dma_addr_t dma_handle);
+struct dma_mapping_ops {
+       int             (*mapping_error)(dma_addr_t dma_addr);
+       void*           (*alloc_coherent)(struct device *dev, size_t size,
+                                dma_addr_t *dma_handle, gfp_t gfp);
+       void            (*free_coherent)(struct device *dev, size_t size,
+                                void *vaddr, dma_addr_t dma_handle);
+       dma_addr_t      (*map_single)(struct device *hwdev, void *ptr,
+                                size_t size, int direction);
+       /* like map_single, but doesn't check the device mask */
+       dma_addr_t      (*map_simple)(struct device *hwdev, char *ptr,
+                                size_t size, int direction);
+       void            (*unmap_single)(struct device *dev, dma_addr_t addr,
+                               size_t size, int direction);
+       void            (*sync_single_for_cpu)(struct device *hwdev,
+                               dma_addr_t dma_handle, size_t size,
+                               int direction);
+       void            (*sync_single_for_device)(struct device *hwdev,
+                                dma_addr_t dma_handle, size_t size,
+                               int direction);
+       void            (*sync_single_range_for_cpu)(struct device *hwdev,
+                                dma_addr_t dma_handle, unsigned long offset,
+                               size_t size, int direction);
+       void            (*sync_single_range_for_device)(struct device *hwdev,
+                               dma_addr_t dma_handle, unsigned long offset,
+                               size_t size, int direction);
+       void            (*sync_sg_for_cpu)(struct device *hwdev,
+                                struct scatterlist *sg, int nelems,
+                               int direction);
+       void            (*sync_sg_for_device)(struct device *hwdev,
+                               struct scatterlist *sg, int nelems,
+                               int direction);
+       int             (*map_sg)(struct device *hwdev, struct scatterlist *sg,
+                               int nents, int direction);
+       void            (*unmap_sg)(struct device *hwdev,
+                               struct scatterlist *sg, int nents,
+                               int direction);
+       int             (*dma_supported)(struct device *hwdev, u64 mask);
+       int             is_phys;
+};
 
-#ifdef CONFIG_GART_IOMMU
+extern dma_addr_t bad_dma_address;
+extern struct dma_mapping_ops* dma_ops;
+extern int iommu_merge;
 
-extern dma_addr_t dma_map_single(struct device *hwdev, void *ptr, size_t size,
-                                int direction);
-extern void dma_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
-                            int direction);
+static inline int dma_mapping_error(dma_addr_t dma_addr)
+{
+       if (dma_ops->mapping_error)
+               return dma_ops->mapping_error(dma_addr);
 
-#else
+       return (dma_addr == bad_dma_address);
+}
 
-/* No IOMMU */
+extern void *dma_alloc_coherent(struct device *dev, size_t size,
+                               dma_addr_t *dma_handle, gfp_t gfp);
+extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
+                             dma_addr_t dma_handle);
 
-static inline dma_addr_t dma_map_single(struct device *hwdev, void *ptr,
-                                       size_t size, int direction)
+static inline dma_addr_t
+dma_map_single(struct device *hwdev, void *ptr, size_t size,
+              int direction)
 {
-       dma_addr_t addr;
-
-       if (direction == DMA_NONE)
-               out_of_line_bug();
-       addr = virt_to_bus(ptr);
-
-       if ((addr+size) & ~*hwdev->dma_mask)
-               out_of_line_bug();
-       return addr;
+       return dma_ops->map_single(hwdev, ptr, size, direction);
 }
 
-static inline void dma_unmap_single(struct device *hwdev, dma_addr_t dma_addr,
-                                   size_t size, int direction)
+static inline void
+dma_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
+                int direction)
 {
-       if (direction == DMA_NONE)
-               out_of_line_bug();
-       /* Nothing to do */
+       dma_ops->unmap_single(dev, addr, size, direction);
 }
 
-#endif
-
 #define dma_map_page(dev,page,offset,size,dir) \
        dma_map_single((dev), page_address(page)+(offset), (size), (dir))
 
-static inline void dma_sync_single_for_cpu(struct device *hwdev,
-                                              dma_addr_t dma_handle,
-                                              size_t size, int direction)
-{
-       if (direction == DMA_NONE)
-               out_of_line_bug();
-
-       if (swiotlb)
-               return swiotlb_sync_single_for_cpu(hwdev,dma_handle,size,direction);
+#define dma_unmap_page dma_unmap_single
 
+static inline void
+dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
+                       size_t size, int direction)
+{
+       if (dma_ops->sync_single_for_cpu)
+               dma_ops->sync_single_for_cpu(hwdev, dma_handle, size,
+                                            direction);
        flush_write_buffers();
 }
 
-static inline void dma_sync_single_for_device(struct device *hwdev,
-                                                 dma_addr_t dma_handle,
-                                                 size_t size, int direction)
+static inline void
+dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle,
+                          size_t size, int direction)
 {
-        if (direction == DMA_NONE)
-               out_of_line_bug();
-
-       if (swiotlb)
-               return swiotlb_sync_single_for_device(hwdev,dma_handle,size,direction);
-
+       if (dma_ops->sync_single_for_device)
+               dma_ops->sync_single_for_device(hwdev, dma_handle, size,
+                                               direction);
        flush_write_buffers();
 }
 
-static inline void dma_sync_single_range_for_cpu(struct device *hwdev,
-                                                dma_addr_t dma_handle,
-                                                unsigned long offset,
-                                                size_t size, int direction)
+static inline void
+dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
+                             unsigned long offset, size_t size, int direction)
 {
-       if (direction == DMA_NONE)
-               out_of_line_bug();
-
-       if (swiotlb)
-               return swiotlb_sync_single_range_for_cpu(hwdev,dma_handle,offset,size,direction);
+       if (dma_ops->sync_single_range_for_cpu) {
+               dma_ops->sync_single_range_for_cpu(hwdev, dma_handle, offset, size, direction);
+       }
 
        flush_write_buffers();
 }
 
-static inline void dma_sync_single_range_for_device(struct device *hwdev,
-                                                   dma_addr_t dma_handle,
-                                                   unsigned long offset,
-                                                   size_t size, int direction)
+static inline void
+dma_sync_single_range_for_device(struct device *hwdev, dma_addr_t dma_handle,
+                                unsigned long offset, size_t size, int direction)
 {
-        if (direction == DMA_NONE)
-               out_of_line_bug();
-
-       if (swiotlb)
-               return swiotlb_sync_single_range_for_device(hwdev,dma_handle,offset,size,direction);
+       if (dma_ops->sync_single_range_for_device)
+               dma_ops->sync_single_range_for_device(hwdev, dma_handle,
+                                                     offset, size, direction);
 
        flush_write_buffers();
 }
 
-static inline void dma_sync_sg_for_cpu(struct device *hwdev,
-                                      struct scatterlist *sg,
-                                      int nelems, int direction)
+static inline void
+dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
+                   int nelems, int direction)
 {
-       if (direction == DMA_NONE)
-               out_of_line_bug();
-
-       if (swiotlb)
-               return swiotlb_sync_sg_for_cpu(hwdev,sg,nelems,direction);
-
+       if (dma_ops->sync_sg_for_cpu)
+               dma_ops->sync_sg_for_cpu(hwdev, sg, nelems, direction);
        flush_write_buffers();
 }
 
-static inline void dma_sync_sg_for_device(struct device *hwdev,
-                                         struct scatterlist *sg,
-                                         int nelems, int direction)
+static inline void
+dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
+                      int nelems, int direction)
 {
-       if (direction == DMA_NONE)
-               out_of_line_bug();
-
-       if (swiotlb)
-               return swiotlb_sync_sg_for_device(hwdev,sg,nelems,direction);
+       if (dma_ops->sync_sg_for_device) {
+               dma_ops->sync_sg_for_device(hwdev, sg, nelems, direction);
+       }
 
        flush_write_buffers();
 }
 
-extern int dma_map_sg(struct device *hwdev, struct scatterlist *sg,
-                     int nents, int direction);
-extern void dma_unmap_sg(struct device *hwdev, struct scatterlist *sg,
-                        int nents, int direction);
+static inline int
+dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, int direction)
+{
+       return dma_ops->map_sg(hwdev, sg, nents, direction);
+}
 
-#define dma_unmap_page dma_unmap_single
+static inline void
+dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
+            int direction)
+{
+       dma_ops->unmap_sg(hwdev, sg, nents, direction);
+}
 
 extern int dma_supported(struct device *hwdev, u64 mask);
-extern int dma_get_cache_alignment(void);
-#define dma_is_consistent(h) 1
 
-static inline int dma_set_mask(struct device *dev, u64 mask)
+/* same for gart, swiotlb, and nommu */
+static inline int dma_get_cache_alignment(void)
 {
-       if (!dev->dma_mask || !dma_supported(dev, mask))
-               return -EIO;
-       *dev->dma_mask = mask;
-       return 0;
+       return boot_cpu_data.x86_clflush_size;
 }
 
-static inline void dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction dir)
+#define dma_is_consistent(h) 1
+
+extern int dma_set_mask(struct device *dev, u64 mask);
+
+static inline void
+dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction dir)
 {
        flush_write_buffers();
 }
 
-#endif
+extern struct device fallback_dev;
+extern int panic_on_overflow;
+
+#endif /* _X8664_DMA_MAPPING_H */
index 582757fc03655423d12d96b7baf43d986e6fe031..07654bd155bf9d44c35fc4a619b8506692fc6b5e 100644 (file)
@@ -14,7 +14,7 @@
    away for older version. 
  */
 
-#ifdef CONFIG_DEBUG_INFO
+#ifdef CONFIG_UNWIND_INFO
 
 #define CFI_STARTPROC .cfi_startproc
 #define CFI_ENDPROC .cfi_endproc
@@ -28,6 +28,7 @@
 #define CFI_RESTORE .cfi_restore
 #define CFI_REMEMBER_STATE .cfi_remember_state
 #define CFI_RESTORE_STATE .cfi_restore_state
+#define CFI_UNDEFINED .cfi_undefined
 
 #else
 
@@ -44,6 +45,7 @@
 #define CFI_RESTORE    #
 #define CFI_REMEMBER_STATE     #
 #define CFI_RESTORE_STATE      #
+#define CFI_UNDEFINED  #
 
 #endif
 
diff --git a/include/asm-x86_64/gart-mapping.h b/include/asm-x86_64/gart-mapping.h
new file mode 100644 (file)
index 0000000..ada497b
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef _X8664_GART_MAPPING_H
+#define _X8664_GART_MAPPING_H 1
+
+#include <linux/types.h>
+#include <asm/types.h>
+
+struct device;
+
+extern void*
+gart_alloc_coherent(struct device *dev, size_t size,
+        dma_addr_t *dma_handle, gfp_t gfp);
+
+extern int
+gart_dma_supported(struct device *hwdev, u64 mask);
+
+#endif /* _X8664_GART_MAPPING_H */
index c14a8c7267a69b4230ca0b92a68ffa9db5686b92..0df1715dee7186b1cce490e86c6456d6b7d2466b 100644 (file)
@@ -46,18 +46,18 @@ struct hw_interrupt_type;
  *  some of the following vectors are 'rare', they are merged
  *  into a single vector (CALL_FUNCTION_VECTOR) to save vector space.
  *  TLB, reschedule and local APIC vectors are performance-critical.
- *
- *  Vectors 0xf0-0xf9 are free (reserved for future Linux use).
  */
 #define SPURIOUS_APIC_VECTOR   0xff
 #define ERROR_APIC_VECTOR      0xfe
 #define RESCHEDULE_VECTOR      0xfd
 #define CALL_FUNCTION_VECTOR   0xfc
-#define KDB_VECTOR             0xfb    /* reserved for KDB */
+/* fb free - please don't readd KDB here because it's useless
+   (hint - think what a NMI bit does to a vector) */
 #define THERMAL_APIC_VECTOR    0xfa
 #define THRESHOLD_APIC_VECTOR   0xf9
-#define INVALIDATE_TLB_VECTOR_END      0xf8
-#define INVALIDATE_TLB_VECTOR_START    0xf0    /* f0-f8 used for TLB flush */
+/* f8 free */
+#define INVALIDATE_TLB_VECTOR_END      0xf7
+#define INVALIDATE_TLB_VECTOR_START    0xf0    /* f0-f7 used for TLB flush */
 
 #define NUM_INVALIDATE_TLB_VECTORS     8
 
index aa39cfd0e0016f212a124097bb4bf5e563251539..876eb9a2fe7868a7c7ce01ef694403b3150f4601 100644 (file)
@@ -30,7 +30,7 @@ extern int save_i387(struct _fpstate __user *buf);
  */
 
 #define unlazy_fpu(tsk) do { \
-       if ((tsk)->thread_info->status & TS_USEDFPU) \
+       if (task_thread_info(tsk)->status & TS_USEDFPU) \
                save_init_fpu(tsk); \
 } while (0)
 
@@ -46,9 +46,9 @@ static inline void tolerant_fwait(void)
 }
 
 #define clear_fpu(tsk) do { \
-       if ((tsk)->thread_info->status & TS_USEDFPU) {          \
+       if (task_thread_info(tsk)->status & TS_USEDFPU) {       \
                tolerant_fwait();                               \
-               (tsk)->thread_info->status &= ~TS_USEDFPU;      \
+               task_thread_info(tsk)->status &= ~TS_USEDFPU;   \
                stts();                                         \
        }                                                       \
 } while (0)
@@ -75,7 +75,8 @@ extern int set_fpregs(struct task_struct *tsk,
 static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) 
 { 
        int err;
-       asm volatile("1:  rex64 ; fxrstor (%[fx])\n\t"
+
+       asm volatile("1:  rex64/fxrstor (%[fx])\n\t"
                     "2:\n"
                     ".section .fixup,\"ax\"\n"
                     "3:  movl $-1,%[err]\n"
@@ -86,7 +87,11 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
                     "   .quad  1b,3b\n"
                     ".previous"
                     : [err] "=r" (err)
-                    : [fx] "r" (fx), "0" (0)); 
+#if 0 /* See comment in __fxsave_clear() below. */
+                    : [fx] "r" (fx), "m" (*fx), "0" (0));
+#else
+                    : [fx] "cdaSDb" (fx), "m" (*fx), "0" (0));
+#endif
        if (unlikely(err))
                init_fpu(current);
        return err;
@@ -95,7 +100,8 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx)
 static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) 
 { 
        int err;
-       asm volatile("1:  rex64 ; fxsave (%[fx])\n\t"
+
+       asm volatile("1:  rex64/fxsave (%[fx])\n\t"
                     "2:\n"
                     ".section .fixup,\"ax\"\n"
                     "3:  movl $-1,%[err]\n"
@@ -105,20 +111,53 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx)
                     "   .align 8\n"
                     "   .quad  1b,3b\n"
                     ".previous"
-                    : [err] "=r" (err)
-                    : [fx] "r" (fx), "0" (0)); 
+                    : [err] "=r" (err), "=m" (*fx)
+#if 0 /* See comment in __fxsave_clear() below. */
+                    : [fx] "r" (fx), "0" (0));
+#else
+                    : [fx] "cdaSDb" (fx), "0" (0));
+#endif
        if (unlikely(err))
                __clear_user(fx, sizeof(struct i387_fxsave_struct));
        return err;
 } 
 
+static inline void __fxsave_clear(struct task_struct *tsk)
+{
+       /* Using "rex64; fxsave %0" is broken because, if the memory operand
+          uses any extended registers for addressing, a second REX prefix
+          will be generated (to the assembler, rex64 followed by semicolon
+          is a separate instruction), and hence the 64-bitness is lost. */
+#if 0
+       /* Using "fxsaveq %0" would be the ideal choice, but is only supported
+          starting with gas 2.16. */
+       __asm__ __volatile__("fxsaveq %0"
+                            : "=m" (tsk->thread.i387.fxsave));
+#elif 0
+       /* Using, as a workaround, the properly prefixed form below isn't
+          accepted by any binutils version so far released, complaining that
+          the same type of prefix is used twice if an extended register is
+          needed for addressing (fix submitted to mainline 2005-11-21). */
+       __asm__ __volatile__("rex64/fxsave %0"
+                            : "=m" (tsk->thread.i387.fxsave));
+#else
+       /* This, however, we can work around by forcing the compiler to select
+          an addressing mode that doesn't require extended registers. */
+       __asm__ __volatile__("rex64/fxsave %P2(%1)"
+                            : "=m" (tsk->thread.i387.fxsave)
+                            : "cdaSDb" (tsk),
+                               "i" (offsetof(__typeof__(*tsk),
+                                             thread.i387.fxsave)));
+#endif
+       __asm__ __volatile__("fnclex");
+}
+
 static inline void kernel_fpu_begin(void)
 {
        struct thread_info *me = current_thread_info();
        preempt_disable();
-       if (me->status & TS_USEDFPU) { 
-               asm volatile("rex64 ; fxsave %0 ; fnclex"
-                             : "=m" (me->task->thread.i387.fxsave));
+       if (me->status & TS_USEDFPU) {
+               __fxsave_clear(me->task);
                me->status &= ~TS_USEDFPU;
                return;
        }
@@ -131,11 +170,10 @@ static inline void kernel_fpu_end(void)
        preempt_enable();
 }
 
-static inline void save_init_fpu( struct task_struct *tsk )
+static inline void save_init_fpu(struct task_struct *tsk)
 {
-       asm volatile( "rex64 ; fxsave %0 ; fnclex"
-                     : "=m" (tsk->thread.i387.fxsave));
-       tsk->thread_info->status &= ~TS_USEDFPU;
+       __fxsave_clear(tsk);
+       task_thread_info(tsk)->status &= ~TS_USEDFPU;
        stts();
 }
 
diff --git a/include/asm-x86_64/idle.h b/include/asm-x86_64/idle.h
new file mode 100644 (file)
index 0000000..6bd47dc
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _ASM_X86_64_IDLE_H
+#define _ASM_X86_64_IDLE_H 1
+
+#define IDLE_START 1
+#define IDLE_END 2
+
+struct notifier_block;
+void idle_notifier_register(struct notifier_block *n);
+void idle_notifier_unregister(struct notifier_block *n);
+
+void enter_idle(void);
+void exit_idle(void);
+
+#endif
index 52ff269fe05473ff255d8ced8c87f80a274e57b9..9dac18db829127db42b6ee3ea7135261e982b825 100644 (file)
@@ -143,6 +143,11 @@ static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
 extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
 extern void iounmap(volatile void __iomem *addr);
 
+/* Use normal IO mappings for DMI */
+#define dmi_ioremap ioremap
+#define dmi_iounmap(x,l) iounmap(x)
+#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
+
 /*
  * ISA I/O bus memory addresses are 1:1 with the physical address.
  */
index 022e9d340ad759cbc763458ed5df2cc186f2eafe..2a5c162b7d925c1fc5ba7b1db1cbf6a8fe2f933a 100644 (file)
@@ -38,10 +38,6 @@ static inline unsigned int __prepare_ICR (unsigned int shortcut, int vector, uns
                icr |= APIC_DM_FIXED | vector;
                break;
        case NMI_VECTOR:
-               /*
-                * Setup KDB IPI to be delivered as an NMI
-                */
-       case KDB_VECTOR:
                icr |= APIC_DM_NMI;
                break;
        }
index f604e84c53039e784e10605b3b3e428af9d91deb..b9ed4c0c878322e3e24fea53e4c5ab3ac9b0a38e 100644 (file)
@@ -35,9 +35,16 @@ enum die_val {
        DIE_PAGE_FAULT,
 }; 
        
-static inline int notify_die(enum die_val val,char *str,struct pt_regs *regs,long err,int trap, int sig)
-{ 
-       struct die_args args = { .regs=regs, .str=str, .err=err, .trapnr=trap,.signr=sig }; 
+static inline int notify_die(enum die_val val, const char *str,
+                       struct pt_regs *regs, long err, int trap, int sig)
+{
+       struct die_args args = {
+               .regs = regs,
+               .str = str,
+               .err = err,
+               .trapnr = trap,
+               .signr = sig
+       };
        return notifier_call_chain(&die_chain, val, &args); 
 } 
 
index b630d52bdfb1e030473926b4440fc62fb0c68536..16e4be4de0c558d4515fc3517f225f834cd94637 100644 (file)
 int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
 void destroy_context(struct mm_struct *mm);
 
-#ifdef CONFIG_SMP
-
 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 {
+#ifdef CONFIG_SMP
        if (read_pda(mmu_state) == TLBSTATE_OK) 
                write_pda(mmu_state, TLBSTATE_LAZY);
-}
-#else
-static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
 #endif
+}
 
 static inline void load_cr3(pgd_t *pgd)
 {
index 69baaa8a3ce0078b5f9226b218bc0944272bc9c4..972c9359f7d739ff5ffe4f34b2450a218faeaeab 100644 (file)
@@ -36,22 +36,12 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
                                 NODE_DATA(nid)->node_spanned_pages)
 
 #ifdef CONFIG_DISCONTIGMEM
-
 #define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
 #define kvaddr_to_nid(kaddr)   phys_to_nid(__pa(kaddr))
 
-/* Requires pfn_valid(pfn) to be true */
-#define pfn_to_page(pfn) ({ \
-       int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT);    \
-       ((pfn) - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map;   \
-})
-
-#define page_to_pfn(page) \
-       (long)(((page) - page_zone(page)->zone_mem_map) + page_zone(page)->zone_start_pfn)
-
-#define pfn_valid(pfn) ((pfn) >= num_physpages ? 0 : \
-                       ({ u8 nid__ = pfn_to_nid(pfn); \
-                          nid__ != 0xff && (pfn) >= node_start_pfn(nid__) && (pfn) < node_end_pfn(nid__); }))
+extern struct page *pfn_to_page(unsigned long pfn);
+extern unsigned long page_to_pfn(struct page *page);
+extern int pfn_valid(unsigned long pfn);
 #endif
 
 #define local_mapnr(kvaddr) \
index 818abfd262d1708f3318c385594a2e63c23c95fd..11fbee2bd6c068486f850ad39fdc5590ec3c137a 100644 (file)
@@ -104,7 +104,7 @@ do {                                                                        \
 static inline int
 __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
 {
-       if (likely(atomic_cmpxchg(count, 1, 0)) == 1)
+       if (likely(atomic_cmpxchg(count, 1, 0) == 1))
                return 1;
        else
                return 0;
index d51e56fdc3da04d534a5cf618548b0956f1d7868..34e434ce3268409b7cc90f5fb1c6c925d051086c 100644 (file)
@@ -20,6 +20,11 @@ extern int numa_off;
 extern void numa_set_node(int cpu, int node);
 
 extern unsigned char apicid_to_node[256];
+#ifdef CONFIG_NUMA
+extern void __init init_cpu_to_node(void);
+#else
+#define init_cpu_to_node() do {} while (0)
+#endif
 
 #define NUMA_NO_NODE 0xff
 
index 06e489f32472ed0c3241aa651d59a4005b2160cc..dcbb4fcd9a180b33d44023c351f1131580eb77f0 100644 (file)
 #define PHYSICAL_PAGE_MASK     (~(PAGE_SIZE-1) & __PHYSICAL_MASK)
 
 #define THREAD_ORDER 1 
-#ifdef __ASSEMBLY__
-#define THREAD_SIZE  (1 << (PAGE_SHIFT + THREAD_ORDER))
-#else
-#define THREAD_SIZE  (1UL << (PAGE_SHIFT + THREAD_ORDER))
-#endif
+#define THREAD_SIZE  (PAGE_SIZE << THREAD_ORDER)
 #define CURRENT_MASK (~(THREAD_SIZE-1))
 
+#define EXCEPTION_STACK_ORDER 0
+#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
+
+#define DEBUG_STACK_ORDER EXCEPTION_STACK_ORDER
+#define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
+
+#define IRQSTACK_ORDER 2
+#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
+
 #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
 #define LARGE_PAGE_SIZE (1UL << PMD_SHIFT)
 
index eeb3088a1c9e3d2fbbff1140b94fad85c69777f9..fd03e15d7ea6f5edf50d5cfb72743c907aa8f2c1 100644 (file)
@@ -42,18 +42,20 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
 #include <asm/scatterlist.h>
 #include <linux/string.h>
 #include <asm/page.h>
+#include <linux/dma-mapping.h> /* for have_iommu */
 
 extern int iommu_setup(char *opt);
 
-#ifdef CONFIG_GART_IOMMU
 /* The PCI address space does equal the physical memory
  * address space.  The networking and block device layers use
  * this boolean for bounce buffer decisions
  *
- * On AMD64 it mostly equals, but we set it to zero to tell some subsystems
- * that an IOMMU is available.
+ * On AMD64 it mostly equals, but we set it to zero if a hardware
+ * IOMMU (gart) of sotware IOMMU (swiotlb) is available.
  */
-#define PCI_DMA_BUS_IS_PHYS    (no_iommu ? 1 : 0)
+#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
+
+#ifdef CONFIG_GART_IOMMU
 
 /*
  * x86-64 always supports DAC, but sometimes it is useful to force
@@ -79,7 +81,6 @@ extern int iommu_sac_force;
 #else
 /* No IOMMU */
 
-#define PCI_DMA_BUS_IS_PHYS    1
 #define pci_dac_dma_supported(pci_dev, mask)    1
 
 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
index 8733ccfa442ef7802967fd05d4c84859691ba74e..c7ab38a601af58273c1bb5f698d000c0ba6b1cf0 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/stddef.h>
 #include <linux/types.h>
 #include <linux/cache.h>
+#include <asm/page.h>
 
 /* Per processor datastructure. %gs points to it while the kernel runs */ 
 struct x8664_pda {
@@ -12,6 +13,9 @@ struct x8664_pda {
        unsigned long data_offset;      /* Per cpu data offset from linker address */
        unsigned long kernelstack;  /* top of kernel stack for current */ 
        unsigned long oldrsp;       /* user rsp for system call */
+#if DEBUG_STKSZ > EXCEPTION_STKSZ
+       unsigned long debugstack;   /* #DB/#BP stack. */
+#endif
         int irqcount;              /* Irq nesting counter. Starts with -1 */   
        int cpunumber;              /* Logical CPU number */
        char *irqstackptr;      /* top of irqstack */
@@ -23,11 +27,10 @@ struct x8664_pda {
        unsigned apic_timer_irqs;
 } ____cacheline_aligned_in_smp;
 
+extern struct x8664_pda *_cpu_pda[];
+extern struct x8664_pda boot_cpu_pda[];
 
-#define IRQSTACK_ORDER 2
-#define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) 
-
-extern struct x8664_pda cpu_pda[];
+#define cpu_pda(i) (_cpu_pda[i])
 
 /* 
  * There is no fast way to get the base address of the PDA, all the accesses
index 9c71855736fb90d98fc2ddb5a20793f4ce41b593..29a6b0408f755c1f1a8f6fd4c4016845df6b52d7 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <asm/pda.h>
 
-#define __per_cpu_offset(cpu) (cpu_pda[cpu].data_offset)
+#define __per_cpu_offset(cpu) (cpu_pda(cpu)->data_offset)
 #define __my_cpu_offset() read_pda(data_offset)
 
 /* Separate out the type, so (int[3], foo) works. */
index 02888d7a496fc728f024f0cf29d0a189ef4c9ede..8fbf4dd72115da164273d16b90df27ff607638e1 100644 (file)
@@ -267,25 +267,25 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
  */
 #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT)
 static inline int pte_user(pte_t pte)          { return pte_val(pte) & _PAGE_USER; }
-extern inline int pte_read(pte_t pte)          { return pte_val(pte) & _PAGE_USER; }
-extern inline int pte_exec(pte_t pte)          { return pte_val(pte) & _PAGE_USER; }
-extern inline int pte_dirty(pte_t pte)         { return pte_val(pte) & _PAGE_DIRTY; }
-extern inline int pte_young(pte_t pte)         { return pte_val(pte) & _PAGE_ACCESSED; }
-extern inline int pte_write(pte_t pte)         { return pte_val(pte) & _PAGE_RW; }
+static inline int pte_read(pte_t pte)          { return pte_val(pte) & _PAGE_USER; }
+static inline int pte_exec(pte_t pte)          { return pte_val(pte) & _PAGE_USER; }
+static inline int pte_dirty(pte_t pte)         { return pte_val(pte) & _PAGE_DIRTY; }
+static inline int pte_young(pte_t pte)         { return pte_val(pte) & _PAGE_ACCESSED; }
+static inline int pte_write(pte_t pte)         { return pte_val(pte) & _PAGE_RW; }
 static inline int pte_file(pte_t pte)          { return pte_val(pte) & _PAGE_FILE; }
 static inline int pte_huge(pte_t pte)          { return (pte_val(pte) & __LARGE_PTE) == __LARGE_PTE; }
 
-extern inline pte_t pte_rdprotect(pte_t pte)   { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
-extern inline pte_t pte_exprotect(pte_t pte)   { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
-extern inline pte_t pte_mkclean(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
-extern inline pte_t pte_mkold(pte_t pte)       { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
-extern inline pte_t pte_wrprotect(pte_t pte)   { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; }
-extern inline pte_t pte_mkread(pte_t pte)      { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
-extern inline pte_t pte_mkexec(pte_t pte)      { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
-extern inline pte_t pte_mkdirty(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
-extern inline pte_t pte_mkyoung(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
-extern inline pte_t pte_mkwrite(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
-extern inline pte_t pte_mkhuge(pte_t pte)      { set_pte(&pte, __pte(pte_val(pte) | __LARGE_PTE)); return pte; }
+static inline pte_t pte_rdprotect(pte_t pte)   { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
+static inline pte_t pte_exprotect(pte_t pte)   { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_USER)); return pte; }
+static inline pte_t pte_mkclean(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
+static inline pte_t pte_mkold(pte_t pte)       { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; }
+static inline pte_t pte_wrprotect(pte_t pte)   { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW)); return pte; }
+static inline pte_t pte_mkread(pte_t pte)      { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
+static inline pte_t pte_mkexec(pte_t pte)      { set_pte(&pte, __pte(pte_val(pte) | _PAGE_USER)); return pte; }
+static inline pte_t pte_mkdirty(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
+static inline pte_t pte_mkyoung(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
+static inline pte_t pte_mkwrite(pte_t pte)     { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
+static inline pte_t pte_mkhuge(pte_t pte)      { set_pte(&pte, __pte(pte_val(pte) | __LARGE_PTE)); return pte; }
 
 struct vm_area_struct;
 
index 4861246548f716cf5981c2f1f5029bcaa49a9db5..87a282b1043a65cb2188e6c0a17a080c22bd2df6 100644 (file)
@@ -227,7 +227,13 @@ struct tss_struct {
 extern struct cpuinfo_x86 boot_cpu_data;
 DECLARE_PER_CPU(struct tss_struct,init_tss);
 
+#ifdef CONFIG_X86_VSMP
+#define ARCH_MIN_TASKALIGN     (1 << INTERNODE_CACHE_SHIFT)
+#define ARCH_MIN_MMSTRUCT_ALIGN        (1 << INTERNODE_CACHE_SHIFT)
+#else
 #define ARCH_MIN_TASKALIGN     16
+#define ARCH_MIN_MMSTRUCT_ALIGN        0
+#endif
 
 struct thread_struct {
        unsigned long   rsp0;
@@ -273,8 +279,6 @@ struct thread_struct {
 #define DEBUG_STACK 4 
 #define MCE_STACK 5
 #define N_EXCEPTION_STACKS 5  /* hw limit: 7 */
-#define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
-#define EXCEPTION_STACK_ORDER 0 
 
 #define start_thread(regs,new_rip,new_rsp) do { \
        asm volatile("movl %0,%%fs; movl %0,%%es; movl %0,%%ds": :"r" (0));      \
@@ -317,8 +321,8 @@ extern long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 #define thread_saved_pc(t) (*(unsigned long *)((t)->thread.rsp - 8))
 
 extern unsigned long get_wchan(struct task_struct *p);
-#define KSTK_EIP(tsk) \
-       (((struct pt_regs *)(tsk->thread.rsp0 - sizeof(struct pt_regs)))->rip)
+#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.rsp0 - 1)
+#define KSTK_EIP(tsk) (task_pt_regs(tsk)->rip)
 #define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */
 
 
index 34501086afef57a81ab0369dcea9e0e1bad2c76f..115e496c613951bd0ebd5667e18c075e76d5bf60 100644 (file)
@@ -67,8 +67,6 @@ extern void load_gs_index(unsigned gs);
 
 extern unsigned long end_pfn_map; 
 
-extern cpumask_t cpu_initialized;
-
 extern void show_trace(unsigned long * rsp);
 extern void show_registers(struct pt_regs *regs);
 
@@ -91,8 +89,12 @@ extern void check_efer(void);
 
 extern int unhandled_signal(struct task_struct *tsk, int sig);
 
+extern int unsynchronized_tsc(void);
+
 extern void select_idle_routine(const struct cpuinfo_x86 *c);
-extern void swiotlb_init(void);
+
+extern void gart_parse_options(char *);
+extern void __init no_iommu_init(void);
 
 extern unsigned long table_start, table_end;
 
@@ -106,12 +108,17 @@ extern int skip_ioapic_setup;
 extern int acpi_ht;
 extern int acpi_disabled;
 
+#ifdef CONFIG_GART_IOMMU
 extern int fallback_aper_order;
 extern int fallback_aper_force;
 extern int iommu_aperture;
-extern int iommu_aperture_disabled;
 extern int iommu_aperture_allowed;
+extern int iommu_aperture_disabled;
 extern int fix_aperture;
+#else
+#define iommu_aperture 0
+#define iommu_aperture_allowed 0
+#endif
 extern int force_iommu;
 
 extern int reboot_force;
index 44adaf18c11e3c8c172b189e4d39a5cbe0d5e7bb..d4bed33fb32c4ca56eed659843c974b3286fc052 100644 (file)
 #define __USER_DS     0x2b   /* 5*8+3 */ 
 #define __USER_CS     0x33   /* 6*8+3 */ 
 #define __USER32_DS    __USER_DS 
-#define __KERNEL16_CS  (GDT_ENTRY_KERNELCS16 * 8)
-#define __KERNEL_COMPAT32_CS   0x8
 
 #define GDT_ENTRY_TLS 1
 #define GDT_ENTRY_TSS 8        /* needs two entries */
 #define GDT_ENTRY_LDT 10 /* needs two entries */
 #define GDT_ENTRY_TLS_MIN 12
 #define GDT_ENTRY_TLS_MAX 14
-#define GDT_ENTRY_KERNELCS16 15
+/* 15 free */
 
 #define GDT_ENTRY_TLS_ENTRIES 3
 
index d030409a8fb5c61a2663249894834384d106f7f1..9ccbb2cfd5c093110c3a853d2fe0c1d3e11ea9e3 100644 (file)
@@ -35,6 +35,7 @@ extern cpumask_t cpu_present_mask;
 extern cpumask_t cpu_possible_map;
 extern cpumask_t cpu_online_map;
 extern cpumask_t cpu_callout_map;
+extern cpumask_t cpu_initialized;
 
 /*
  * Private routines/data
index dddf1b218681a442c0d3331c5069fb16af17a16a..60757efd1353b9770fc240008955c9dcbfd1ae10 100644 (file)
@@ -3,10 +3,14 @@
 
 #include <linux/config.h>
 
+#include <asm/dma-mapping.h>
+
 /* SWIOTLB interface */
 
-extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr, size_t size,
-                                     int dir);
+extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr,
+                                    size_t size, int dir);
+extern void *swiotlb_alloc_coherent(struct device *hwdev, size_t size,
+                       dma_addr_t *dma_handle, gfp_t flags);
 extern void swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
                                  size_t size, int dir);
 extern void swiotlb_sync_single_for_cpu(struct device *hwdev,
@@ -34,10 +38,10 @@ extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
 extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
                         int nents, int direction);
 extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr);
-extern void *swiotlb_alloc_coherent (struct device *hwdev, size_t size,
-                                    dma_addr_t *dma_handle, gfp_t flags);
 extern void swiotlb_free_coherent (struct device *hwdev, size_t size,
                                   void *vaddr, dma_addr_t dma_handle);
+extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
+extern void swiotlb_init(void);
 
 #ifdef CONFIG_SWIOTLB
 extern int swiotlb;
@@ -45,4 +49,6 @@ extern int swiotlb;
 #define swiotlb 0
 #endif
 
-#endif
+extern void pci_swiotlb_init(void);
+
+#endif /* _ASM_SWTIOLB_H */
index b34cc2ee222be04842ad512945b5e92022996ed5..0eacbefb7dd04aede495c7832af37588df5279ef 100644 (file)
@@ -20,8 +20,8 @@
 #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
 
 /* frame pointer must be last for get_wchan */
-#define SAVE_CONTEXT    "pushfq ; pushq %%rbp ; movq %%rsi,%%rbp\n\t"
-#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popfq\n\t" 
+#define SAVE_CONTEXT    "pushq %%rbp ; movq %%rsi,%%rbp\n\t"
+#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t"
 
 #define __EXTRA_CLOBBER  \
        ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15"
@@ -137,6 +137,21 @@ struct alt_instr {
                      "663:\n\t" newinstr "\n664:\n"   /* replacement */ \
                      ".previous" :: "i" (feature), ##input)
 
+/* Like alternative_input, but with a single output argument */
+#define alternative_io(oldinstr, newinstr, feature, output, input...) \
+       asm volatile ("661:\n\t" oldinstr "\n662:\n"                    \
+                     ".section .altinstructions,\"a\"\n"               \
+                     "  .align 8\n"                                    \
+                     "  .quad 661b\n"            /* label */           \
+                     "  .quad 663f\n"            /* new instruction */ \
+                     "  .byte %c[feat]\n"        /* feature bit */     \
+                     "  .byte 662b-661b\n"       /* sourcelen */       \
+                     "  .byte 664f-663f\n"       /* replacementlen */  \
+                     ".previous\n"                                     \
+                     ".section .altinstr_replacement,\"ax\"\n"         \
+                     "663:\n\t" newinstr "\n664:\n"   /* replacement */ \
+                     ".previous" : output : [feat] "i" (feature), ##input)
+
 /*
  * Clear and set 'TS' bit respectively
  */
@@ -178,6 +193,15 @@ static inline void write_cr4(unsigned long val)
 #define wbinvd() \
        __asm__ __volatile__ ("wbinvd": : :"memory");
 
+/*
+ * On SMP systems, when the scheduler does migration-cost autodetection,
+ * it needs a way to flush as much of the CPU's caches as possible.
+ */
+static inline void sched_cacheflush(void)
+{
+       wbinvd();
+}
+
 #endif /* __KERNEL__ */
 
 #define nop() __asm__ __volatile__ ("nop")
@@ -311,8 +335,25 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
 /* interrupt control.. */
 #define local_save_flags(x)    do { warn_if_not_ulong(x); __asm__ __volatile__("# save_flags \n\t pushfq ; popq %q0":"=g" (x): /* no input */ :"memory"); } while (0)
 #define local_irq_restore(x)   __asm__ __volatile__("# restore_flags \n\t pushq %0 ; popfq": /* no output */ :"g" (x):"memory", "cc")
+
+#ifdef CONFIG_X86_VSMP
+/* Interrupt control for VSMP  architecture */
+#define local_irq_disable()    do { unsigned long flags; local_save_flags(flags); local_irq_restore((flags & ~(1 << 9)) | (1 << 18)); } while (0)
+#define local_irq_enable()     do { unsigned long flags; local_save_flags(flags); local_irq_restore((flags | (1 << 9)) & ~(1 << 18)); } while (0)
+
+#define irqs_disabled()                                        \
+({                                                     \
+       unsigned long flags;                            \
+       local_save_flags(flags);                        \
+       (flags & (1<<18)) || !(flags & (1<<9));         \
+})
+
+/* For spinlocks etc */
+#define local_irq_save(x)      do { local_save_flags(x); local_irq_restore((x & ~(1 << 9)) | (1 << 18)); } while (0)
+#else  /* CONFIG_X86_VSMP */
 #define local_irq_disable()    __asm__ __volatile__("cli": : :"memory")
 #define local_irq_enable()     __asm__ __volatile__("sti": : :"memory")
+
 /* used in the idle loop; sti takes one instruction cycle to complete */
 #define safe_halt()            __asm__ __volatile__("sti; hlt": : :"memory")
 /* used when interrupts are already enabled or to shutdown the processor */
@@ -327,16 +368,10 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
 
 /* For spinlocks etc */
 #define local_irq_save(x)      do { warn_if_not_ulong(x); __asm__ __volatile__("# local_irq_save \n\t pushfq ; popq %0 ; cli":"=g" (x): /* no input */ :"memory"); } while (0)
+#endif
 
 void cpu_idle_wait(void);
 
-/*
- * disable hlt during certain critical i/o operations
- */
-#define HAVE_DISABLE_HLT
-void disable_hlt(void);
-void enable_hlt(void);
-
 extern unsigned long arch_align_stack(unsigned long sp);
 
 #endif
index 08eb6e4f37372492872b4dd52e713aee7b2a5aec..4ac0e0a36934834fb63d0bffa05d3bdbddf66a2b 100644 (file)
@@ -76,8 +76,6 @@ static inline struct thread_info *stack_thread_info(void)
 #define alloc_thread_info(tsk) \
        ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER))
 #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #else /* !__ASSEMBLY__ */
 
@@ -138,6 +136,7 @@ static inline struct thread_info *stack_thread_info(void)
  * have to worry about atomic accesses.
  */
 #define TS_USEDFPU             0x0001  /* FPU was used by this task this quantum (SMP) */
+#define TS_COMPAT              0x0002  /* 32bit syscall active */
 
 #endif /* __KERNEL__ */
 
index f971f45d6d78b63479fa7cf48e9fb4b9efd11833..f18443fcdf04c9a0570727e82b2f6d2d221d07f2 100644 (file)
@@ -10,6 +10,9 @@
 #include <asm/msr.h>
 #include <asm/vsyscall.h>
 #include <asm/hpet.h>
+#include <asm/system.h>
+#include <asm/processor.h>
+#include <linux/compiler.h>
 
 #define CLOCK_TICK_RATE        PIT_TICK_RATE   /* Underlying HZ */
 
@@ -23,6 +26,19 @@ static inline cycles_t get_cycles (void)
        return ret;
 }
 
+/* Like get_cycles, but make sure the CPU is synchronized. */
+static __always_inline cycles_t get_cycles_sync(void)
+{
+       unsigned long long ret;
+       unsigned eax;
+       /* Don't do an additional sync on CPUs where we know
+          RDTSC is already synchronous. */
+       alternative_io(ASM_NOP2, "cpuid", X86_FEATURE_SYNC_RDTSC,
+                         "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
+       rdtscll(ret);
+       return ret;
+}
+
 extern unsigned int cpu_khz;
 
 extern int read_current_timer(unsigned long *timer_value);
index 7d82bc56b9fae2f123326a936699819b4a5effa3..2fa7f27381b40b69d39562a5e6394b1a975ec803 100644 (file)
@@ -39,7 +39,6 @@ extern int __node_distance(int, int);
        .max_interval           = 32,                   \
        .busy_factor            = 32,                   \
        .imbalance_pct          = 125,                  \
-       .cache_hot_time         = (10*1000000),         \
        .cache_nice_tries       = 2,                    \
        .busy_idx               = 3,                    \
        .idle_idx               = 2,                    \
index 1bb8b8a24436b2387a348b8d0ae880e14d61c6c6..2892c4b7a28b01769bd25c88b7a5e9065e7e8a15 100644 (file)
@@ -348,6 +348,7 @@ static inline int __copy_in_user(void __user *dst, const void __user *src, unsig
 long strncpy_from_user(char *dst, const char __user *src, long count);
 long __strncpy_from_user(char *dst, const char __user *src, long count);
 long strnlen_user(const char __user *str, long n);
+long __strnlen_user(const char __user *str, long n);
 long strlen_user(const char __user *str);
 unsigned long clear_user(void __user *mem, unsigned long len);
 unsigned long __clear_user(void __user *mem, unsigned long len);
index 438a3f52f839fa8161fc5c1ac8f2ec7b8f00ec89..a85e16f56d73672dce8de3c61a4ee7de68028c15 100644 (file)
@@ -36,8 +36,8 @@ struct vxtime_data {
        int mode;
 };
 
-#define hpet_readl(a)           readl((void *)fix_to_virt(FIX_HPET_BASE) + a)
-#define hpet_writel(d,a)        writel(d, (void *)fix_to_virt(FIX_HPET_BASE) + a)
+#define hpet_readl(a)           readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
+#define hpet_writel(d,a)        writel(d, (void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
 
 /* vsyscall space (readonly) */
 extern struct vxtime_data __vxtime;
index 9cab5e4298b943c168b267700eae848462b7f367..d1d72ad36f08e4506460b7e1aeaeb6b1b75d337b 100644 (file)
@@ -184,12 +184,12 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 #define release_segments(mm)   do { } while(0)
 #define forget_segments()      do { } while (0)
 
-#define thread_saved_pc(tsk)   (xtensa_pt_regs(tsk)->pc)
+#define thread_saved_pc(tsk)   (task_pt_regs(tsk)->pc)
 
 extern unsigned long get_wchan(struct task_struct *p);
 
-#define KSTK_EIP(tsk)          (xtensa_pt_regs(tsk)->pc)
-#define KSTK_ESP(tsk)          (xtensa_pt_regs(tsk)->areg[1])
+#define KSTK_EIP(tsk)          (task_pt_regs(tsk)->pc)
+#define KSTK_ESP(tsk)          (task_pt_regs(tsk)->areg[1])
 
 #define cpu_relax()  do { } while (0)
 
index aa4fd7fb3ce716db5fdc02680056afd130308859..a5ac71a5205c268cd9cc51bbe4e82d31f6444137 100644 (file)
@@ -113,8 +113,8 @@ struct pt_regs {
 };
 
 #ifdef __KERNEL__
-# define xtensa_pt_regs(tsk) ((struct pt_regs*) \
-  (((long)(tsk)->thread_info + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4)) - 1)
+# define task_pt_regs(tsk) ((struct pt_regs*) \
+  (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
 # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
 # define instruction_pointer(regs) ((regs)->pc)
 extern void show_regs(struct pt_regs *);
index af208d41fd821e842913a326f446315cba4bf57f..5ae34ab715972a812ef81a8e634e18d8ea50b776 100644 (file)
@@ -93,8 +93,6 @@ static inline struct thread_info *current_thread_info(void)
 /* thread information allocation */
 #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
 
 #else /* !__ASSEMBLY__ */
 
index 6b4618902d3dd3f9fcb6298326a757dac415fb87..5a23ce7526292fa6e406ccae0ea3926b5bb210e3 100644 (file)
@@ -43,6 +43,7 @@ typedef struct __user_cap_data_struct {
 #ifdef __KERNEL__
 
 #include <linux/spinlock.h>
+#include <asm/current.h>
 
 /* #define STRICT_CAP_T_TYPECHECKS */
 
@@ -356,6 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c)
 
 #define cap_is_fs_cap(c)     (CAP_TO_MASK(c) & CAP_FS_MASK)
 
+extern int capable(int cap);
+
 #endif /* __KERNEL__ */
 
 #endif /* !_LINUX_CAPABILITY_H */
index 05f4132622fc7eeea7972e427cadf72ed1ee068b..2e6bbe0141578d832312043fe20abfdc8bf74c1a 100644 (file)
@@ -2,6 +2,7 @@
 #define __DMI_H__
 
 #include <linux/list.h>
+#include <linux/config.h>
 
 enum dmi_field {
        DMI_NONE,
@@ -60,12 +61,14 @@ struct dmi_device {
        void *device_data;      /* Type specific data */
 };
 
-#if defined(CONFIG_X86_32)
+#ifdef CONFIG_DMI
 
 extern int dmi_check_system(struct dmi_system_id *list);
 extern char * dmi_get_system_info(int field);
 extern struct dmi_device * dmi_find_device(int type, const char *name,
        struct dmi_device *from);
+extern void dmi_scan_machine(void);
+
 #else
 
 static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
index 8b2eab90abb6ef690fb4ba12db6e9c287d6c2865..20f9148e38d930e23d33c8c80376c7e6018ea9e0 100644 (file)
@@ -57,6 +57,7 @@ struct vm_area_struct;
                        __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
                        __GFP_NOMEMALLOC|__GFP_HARDWALL)
 
+/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
 #define GFP_ATOMIC     (__GFP_HIGH)
 #define GFP_NOIO       (__GFP_WAIT)
 #define GFP_NOFS       (__GFP_WAIT | __GFP_IO)
@@ -109,6 +110,10 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
        if (unlikely(order >= MAX_ORDER))
                return NULL;
 
+       /* Unknown node is current node */
+       if (nid < 0)
+               nid = numa_node_id();
+
        return __alloc_pages(gfp_mask, order,
                NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
 }
index 10005bc92a316000321e89ea87a76d3e7599b1ea..669756bc20a220faebad33b63c268f5ca6add844 100644 (file)
@@ -68,6 +68,9 @@ struct kprobe {
        /* list of kprobes for multi-handler support */
        struct list_head list;
 
+       /* Indicates that the corresponding module has been ref counted */
+       unsigned int mod_refcounted;
+
        /*count the number of times this probe was temporarily disarmed */
        unsigned long nmissed;
 
index e53d2c6fd5f4b0ef2321d12d7a6d75bf7c9dae4c..c643016499a17860605566a77ea2c622f83f0ffe 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <linux/sched.h>
 #include <linux/errno.h>
+#include <linux/capability.h>
 
 #ifdef __KERNEL__
 
index 7e4ae6ab197724f1010544d20ddbddefb49e4dca..34cbefd2ebded8437ab2cb82d6613264593df9a5 100644 (file)
@@ -98,7 +98,7 @@ struct per_cpu_pageset {
 
 /*
  * On machines where it is needed (eg PCs) we divide physical memory
- * into multiple physical zones. On a PC we have 4 zones:
+ * into multiple physical zones. On a 32bit PC we have 4 zones:
  *
  * ZONE_DMA      < 16 MB       ISA DMA capable memory
  * ZONE_DMA32       0 MB       Empty
index f55c98a68aa913c0a12aefb233ddcc7fcff9e3d2..7fb397e3f2d339f198fed3b08cd60a58e6927f5b 100644 (file)
 #define PCI_DEVICE_ID_INTEL_IXP2800    0x9004
 #define PCI_DEVICE_ID_INTEL_S21152BB   0xb152
 
+#define PCI_VENDOR_ID_SCALEMP          0x8686
+#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
+
 #define PCI_VENDOR_ID_COMPUTONE                0x8e0e
 #define PCI_DEVICE_ID_COMPUTONE_IP2EX  0x0291
 #define PCI_DEVICE_ID_COMPUTONE_PG     0x0302
index c4ee35dd18aec3baca993e342233f5ccfda96e56..a72e17135421890ec73b11c8b89404652a6e6b43 100644 (file)
@@ -631,7 +631,14 @@ struct sched_domain {
 
 extern void partition_sched_domains(cpumask_t *partition1,
                                    cpumask_t *partition2);
-#endif /* CONFIG_SMP */
+
+/*
+ * Maximum cache size the migration-costs auto-tuning code will
+ * search from:
+ */
+extern unsigned int max_cache_size;
+
+#endif /* CONFIG_SMP */
 
 
 struct io_context;                     /* See blkdev.h */
@@ -689,8 +696,11 @@ struct task_struct {
 
        int lock_depth;         /* BKL lock depth */
 
-#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
+#if defined(CONFIG_SMP)
+       int last_waker_cpu;     /* CPU that last woke this task up */
+#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
        int oncpu;
+#endif
 #endif
        int prio, static_prio;
        struct list_head run_list;
@@ -1112,21 +1122,6 @@ static inline int sas_ss_flags(unsigned long sp)
                : on_sig_stack(sp) ? SS_ONSTACK : 0);
 }
 
-
-#ifdef CONFIG_SECURITY
-/* code is in security.c */
-extern int capable(int cap);
-#else
-static inline int capable(int cap)
-{
-       if (cap_raised(current->cap_effective, cap)) {
-               current->flags |= PF_SUPERPRIV;
-               return 1;
-       }
-       return 0;
-}
-#endif
-
 /*
  * Routines for handling mm_structs
  */
@@ -1245,6 +1240,7 @@ static inline void task_unlock(struct task_struct *p)
 #ifndef __HAVE_THREAD_FUNCTIONS
 
 #define task_thread_info(task) (task)->thread_info
+#define task_stack_page(task) ((void*)((task)->thread_info))
 
 static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org)
 {
index 3df1d474e5c56dcd4ce2ca4d371ad86fc945368b..315a5163d6a01a7f891251550feaf89716219803 100644 (file)
@@ -86,7 +86,6 @@
        .max_interval           = 2,                    \
        .busy_factor            = 8,                    \
        .imbalance_pct          = 110,                  \
-       .cache_hot_time         = 0,                    \
        .cache_nice_tries       = 0,                    \
        .per_cpu_gain           = 25,                   \
        .busy_idx               = 0,                    \
        .max_interval           = 4,                    \
        .busy_factor            = 64,                   \
        .imbalance_pct          = 125,                  \
-       .cache_hot_time         = (5*1000000/2),        \
        .cache_nice_tries       = 1,                    \
        .per_cpu_gain           = 100,                  \
        .busy_idx               = 2,                    \
index 7674b121ce8bb4c4005f601ea867d4584b0f24c5..27cbf08c931dcc007648c31ae138dd139217f34a 100644 (file)
@@ -218,8 +218,8 @@ extern int tea5767_autodetection(struct i2c_client *c);
        printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
                        i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
 #define tuner_dbg(fmt, arg...) do {\
-       extern int debug; \
-       if (debug) \
+       extern int tuner_debug; \
+       if (tuner_debug) \
                printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
                        i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
 
index 3cc3132f391ec967839f39ff8423f1d8502b2b6b..c74052abb189d0243e2291ee18786d596479f3c7 100644 (file)
@@ -49,9 +49,8 @@
 
 /* These three macros assume that the debug level is set with a module
    parameter called 'debug'. */
-#define v4l_dbg(level, client, fmt, arg...)                                 \
+#define v4l_dbg(level, debug, client, fmt, arg...)                          \
        do {                                                                 \
-               extern int debug;                                            \
                if (debug >= (level))                                        \
                        v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
        } while (0)
index 9bdd5492a95b4e8711a7e5969322fcc1e1c0dee6..25f4d74adf7ed49d48a635b93b215b4f3bd96352 100644 (file)
@@ -326,15 +326,6 @@ config BUG
           option for embedded systems with no facilities for reporting errors.
           Just say Y.
 
-config DOUBLEFAULT
-       depends X86
-       default y if X86
-       bool "Enable doublefault exception handler" if EMBEDDED
-       help
-          This option allows trapping of rare doublefault exceptions that
-          would otherwise cause a system to silently reboot. Disabling this
-          option saves about 4k.
-
 config ELF_CORE
        default y
        bool "Enable ELF core dumps" if EMBEDDED
index a8aa6152eea6b0f0e07c5d5470cf1892970d189b..4e776f9c80e7c1fbe0da01a1dcdc9f63c04ebd89 100644 (file)
@@ -11,6 +11,7 @@
  * This file is released under the GPL.
  */
 
+#include <linux/capability.h>
 #include <linux/init.h>
 #include <linux/pagemap.h>
 #include <linux/file.h>
index d035bd2aba9671cc56fdd6f10b81182ac628b011..a91b64763b86ed282d993552216b60c734833031 100644 (file)
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -15,6 +15,7 @@
  * (c) 1999 Manfred Spraul <manfreds@colorfullife.com>
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/slab.h>
 #include <linux/msg.h>
index cb5bb2a5df96f417f5c44b1108e8483ee3a10585..46bb8a678decb50f760193c94cf2dcbce9f0e4e8 100644 (file)
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -73,6 +73,7 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/audit.h>
+#include <linux/capability.h>
 #include <linux/seq_file.h>
 #include <asm/uaccess.h>
 #include "util.h"
index 0b92e874fc068fb1bc34f3e5940cfb45542f29f7..4c28d2d8e305cca5781f02117b55e9b21922bdd0 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -27,6 +27,7 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/audit.h>
+#include <linux/capability.h>
 #include <linux/ptrace.h>
 #include <linux/seq_file.h>
 
index 23f1cec150c106dd7e0aa17e34699679c70e02dc..38b9a0af3bd86373b38106fe7ca00bfe745aca05 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/smp_lock.h>
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
+#include <linux/capability.h>
 #include <linux/highuid.h>
 #include <linux/security.h>
 #include <linux/rcupdate.h>
index 38d57fa6b78fe8d02c6a053f9f06b6902a0b41c2..065d8b4e51ef921fedc018c103ed4124d664ad71 100644 (file)
@@ -47,6 +47,7 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/acct.h>
+#include <linux/capability.h>
 #include <linux/file.h>
 #include <linux/tty.h>
 #include <linux/security.h>
index 8986a37a67ea32290a725826a0b7b8c07a7d01b1..bfa3c92e16f2b1c5a9971335f6500cb17a6c8a49 100644 (file)
@@ -7,6 +7,7 @@
  * 30 May 2002:        Cleanup, Robert M. Love <rml@tech9.net>
  */ 
 
+#include <linux/capability.h>
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/security.h>
index 802722814925d6391bb021d99106314c7c6b085e..f8e609ff1893f2d85f76f4b56cba97135b97d152 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/interrupt.h>
 #include <linux/smp_lock.h>
 #include <linux/module.h>
+#include <linux/capability.h>
 #include <linux/completion.h>
 #include <linux/personality.h>
 #include <linux/tty.h>
index 3bdcab49998d2dd43bf951ae87a855e955eaf090..4ae8cfc1c89cffdee486c2a3b28316e583a40747 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/binfmts.h>
 #include <linux/mman.h>
 #include <linux/fs.h>
+#include <linux/capability.h>
 #include <linux/cpu.h>
 #include <linux/cpuset.h>
 #include <linux/security.h>
@@ -1297,6 +1298,10 @@ long do_fork(unsigned long clone_flags,
        return pid;
 }
 
+#ifndef ARCH_MIN_MMSTRUCT_ALIGN
+#define ARCH_MIN_MMSTRUCT_ALIGN 0
+#endif
+
 void __init proc_caches_init(void)
 {
        sighand_cachep = kmem_cache_create("sighand_cache",
@@ -1315,6 +1320,6 @@ void __init proc_caches_init(void)
                        sizeof(struct vm_area_struct), 0,
                        SLAB_PANIC, NULL, NULL);
        mm_cachep = kmem_cache_create("mm_struct",
-                       sizeof(struct mm_struct), 0,
+                       sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN,
                        SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
 }
index de1441656efdacf2d86a5db5226fb6e7f1469655..bf39d28e4c0e7b44313124d84681f012ca193713 100644 (file)
@@ -6,6 +6,7 @@
  * Version 2.  See the file COPYING for more details.
  */
 
+#include <linux/capability.h>
 #include <linux/mm.h>
 #include <linux/file.h>
 #include <linux/slab.h>
index 34a885bb82e0d94a38a7ebec8e8014cf2dc197d1..3ea6325228dafd293b8421ac4d47ea49457b17a0 100644 (file)
@@ -449,19 +449,32 @@ static int __kprobes in_kprobes_functions(unsigned long addr)
        return 0;
 }
 
-int __kprobes register_kprobe(struct kprobe *p)
+static int __kprobes __register_kprobe(struct kprobe *p,
+       unsigned long called_from)
 {
        int ret = 0;
        struct kprobe *old_p;
-       struct module *mod;
+       struct module *probed_mod;
 
        if ((!kernel_text_address((unsigned long) p->addr)) ||
                in_kprobes_functions((unsigned long) p->addr))
                return -EINVAL;
 
-       if ((mod = module_text_address((unsigned long) p->addr)) &&
-                       (unlikely(!try_module_get(mod))))
-               return -EINVAL;
+       p->mod_refcounted = 0;
+       /* Check are we probing a module */
+       if ((probed_mod = module_text_address((unsigned long) p->addr))) {
+               struct module *calling_mod = module_text_address(called_from);
+               /* We must allow modules to probe themself and
+                * in this case avoid incrementing the module refcount,
+                * so as to allow unloading of self probing modules.
+                */
+               if (calling_mod && (calling_mod != probed_mod)) {
+                       if (unlikely(!try_module_get(probed_mod)))
+                               return -EINVAL;
+                       p->mod_refcounted = 1;
+               } else
+                       probed_mod = NULL;
+       }
 
        p->nmissed = 0;
        down(&kprobe_mutex);
@@ -483,11 +496,17 @@ int __kprobes register_kprobe(struct kprobe *p)
 out:
        up(&kprobe_mutex);
 
-       if (ret && mod)
-               module_put(mod);
+       if (ret && probed_mod)
+               module_put(probed_mod);
        return ret;
 }
 
+int __kprobes register_kprobe(struct kprobe *p)
+{
+       return __register_kprobe(p,
+               (unsigned long)__builtin_return_address(0));
+}
+
 void __kprobes unregister_kprobe(struct kprobe *p)
 {
        struct module *mod;
@@ -524,7 +543,8 @@ valid_p:
        up(&kprobe_mutex);
 
        synchronize_sched();
-       if ((mod = module_text_address((unsigned long)p->addr)))
+       if (p->mod_refcounted &&
+           (mod = module_text_address((unsigned long)p->addr)))
                module_put(mod);
 
        if (cleanup_p) {
@@ -547,7 +567,8 @@ int __kprobes register_jprobe(struct jprobe *jp)
        jp->kp.pre_handler = setjmp_pre_handler;
        jp->kp.break_handler = longjmp_break_handler;
 
-       return register_kprobe(&jp->kp);
+       return __register_kprobe(&jp->kp,
+               (unsigned long)__builtin_return_address(0));
 }
 
 void __kprobes unregister_jprobe(struct jprobe *jp)
@@ -587,7 +608,8 @@ int __kprobes register_kretprobe(struct kretprobe *rp)
 
        rp->nmissed = 0;
        /* Establish function entry probe point */
-       if ((ret = register_kprobe(&rp->kp)) != 0)
+       if ((ret = __register_kprobe(&rp->kp,
+               (unsigned long)__builtin_return_address(0))) != 0)
                free_rp_inst(rp);
        return ret;
 }
index e4276046a1b62489b9b4e60362119ad95656e438..618ed6e23ecccf12b16d9bac17a62510758989be 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/syscalls.h>
 #include <linux/fcntl.h>
 #include <linux/rcupdate.h>
+#include <linux/capability.h>
 #include <linux/cpu.h>
 #include <linux/moduleparam.h>
 #include <linux/errno.h>
index cceaf09ac413a4da1b9ea3d27d7655cb405e785c..5f33cdb6fff5f7e629842a8bee7865bb2607515c 100644 (file)
@@ -7,6 +7,7 @@
  * to continually duplicate across every architecture.
  */
 
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
index 34a945bcc022a6767ae2ed4adbcd5d56716db98b..c9dec2aa19760c9dd54905556181692054ade31e 100644 (file)
 #include <linux/smp_lock.h>
 #include <asm/mmu_context.h>
 #include <linux/interrupt.h>
+#include <linux/capability.h>
 #include <linux/completion.h>
 #include <linux/kernel_stat.h>
 #include <linux/security.h>
 #include <linux/notifier.h>
 #include <linux/profile.h>
 #include <linux/suspend.h>
+#include <linux/vmalloc.h>
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include <linux/smp.h>
@@ -1288,6 +1290,9 @@ static int try_to_wake_up(task_t *p, unsigned int state, int sync)
                }
        }
 
+       if (p->last_waker_cpu != this_cpu)
+               goto out_set_cpu;
+
        if (unlikely(!cpu_isset(this_cpu, p->cpus_allowed)))
                goto out_set_cpu;
 
@@ -1358,6 +1363,8 @@ out_set_cpu:
                cpu = task_cpu(p);
        }
 
+       p->last_waker_cpu = this_cpu;
+
 out_activate:
 #endif /* CONFIG_SMP */
        if (old_state == TASK_UNINTERRUPTIBLE) {
@@ -1439,9 +1446,12 @@ void fastcall sched_fork(task_t *p, int clone_flags)
 #ifdef CONFIG_SCHEDSTATS
        memset(&p->sched_info, 0, sizeof(p->sched_info));
 #endif
-#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
+#if defined(CONFIG_SMP)
+       p->last_waker_cpu = cpu;
+#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
        p->oncpu = 0;
 #endif
+#endif
 #ifdef CONFIG_PREEMPT
        /* Want to start with kernel preemption disabled. */
        task_thread_info(p)->preempt_count = 1;
@@ -3979,12 +3989,12 @@ asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
  * method, such as ACPI for e.g.
  */
 
-cpumask_t cpu_present_map;
+cpumask_t cpu_present_map __read_mostly;
 EXPORT_SYMBOL(cpu_present_map);
 
 #ifndef CONFIG_SMP
-cpumask_t cpu_online_map = CPU_MASK_ALL;
-cpumask_t cpu_possible_map = CPU_MASK_ALL;
+cpumask_t cpu_online_map __read_mostly = CPU_MASK_ALL;
+cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL;
 #endif
 
 long sched_getaffinity(pid_t pid, cpumask_t *mask)
@@ -5081,7 +5091,470 @@ static void init_sched_build_groups(struct sched_group groups[], cpumask_t span,
 
 #define SD_NODES_PER_DOMAIN 16
 
+/*
+ * Self-tuning task migration cost measurement between source and target CPUs.
+ *
+ * This is done by measuring the cost of manipulating buffers of varying
+ * sizes. For a given buffer-size here are the steps that are taken:
+ *
+ * 1) the source CPU reads+dirties a shared buffer
+ * 2) the target CPU reads+dirties the same shared buffer
+ *
+ * We measure how long they take, in the following 4 scenarios:
+ *
+ *  - source: CPU1, target: CPU2 | cost1
+ *  - source: CPU2, target: CPU1 | cost2
+ *  - source: CPU1, target: CPU1 | cost3
+ *  - source: CPU2, target: CPU2 | cost4
+ *
+ * We then calculate the cost3+cost4-cost1-cost2 difference - this is
+ * the cost of migration.
+ *
+ * We then start off from a small buffer-size and iterate up to larger
+ * buffer sizes, in 5% steps - measuring each buffer-size separately, and
+ * doing a maximum search for the cost. (The maximum cost for a migration
+ * normally occurs when the working set size is around the effective cache
+ * size.)
+ */
+#define SEARCH_SCOPE           2
+#define MIN_CACHE_SIZE         (64*1024U)
+#define DEFAULT_CACHE_SIZE     (5*1024*1024U)
+#define ITERATIONS             2
+#define SIZE_THRESH            130
+#define COST_THRESH            130
+
+/*
+ * The migration cost is a function of 'domain distance'. Domain
+ * distance is the number of steps a CPU has to iterate down its
+ * domain tree to share a domain with the other CPU. The farther
+ * two CPUs are from each other, the larger the distance gets.
+ *
+ * Note that we use the distance only to cache measurement results,
+ * the distance value is not used numerically otherwise. When two
+ * CPUs have the same distance it is assumed that the migration
+ * cost is the same. (this is a simplification but quite practical)
+ */
+#define MAX_DOMAIN_DISTANCE 32
+
+static unsigned long long migration_cost[MAX_DOMAIN_DISTANCE] =
+               { [ 0 ... MAX_DOMAIN_DISTANCE-1 ] = -1LL };
+
+/*
+ * Allow override of migration cost - in units of microseconds.
+ * E.g. migration_cost=1000,2000,3000 will set up a level-1 cost
+ * of 1 msec, level-2 cost of 2 msecs and level3 cost of 3 msecs:
+ */
+static int __init migration_cost_setup(char *str)
+{
+       int ints[MAX_DOMAIN_DISTANCE+1], i;
+
+       str = get_options(str, ARRAY_SIZE(ints), ints);
+
+       printk("#ints: %d\n", ints[0]);
+       for (i = 1; i <= ints[0]; i++) {
+               migration_cost[i-1] = (unsigned long long)ints[i]*1000;
+               printk("migration_cost[%d]: %Ld\n", i-1, migration_cost[i-1]);
+       }
+       return 1;
+}
+
+__setup ("migration_cost=", migration_cost_setup);
+
+/*
+ * Global multiplier (divisor) for migration-cutoff values,
+ * in percentiles. E.g. use a value of 150 to get 1.5 times
+ * longer cache-hot cutoff times.
+ *
+ * (We scale it from 100 to 128 to long long handling easier.)
+ */
+
+#define MIGRATION_FACTOR_SCALE 128
+
+static unsigned int migration_factor = MIGRATION_FACTOR_SCALE;
+
+static int __init setup_migration_factor(char *str)
+{
+       get_option(&str, &migration_factor);
+       migration_factor = migration_factor * MIGRATION_FACTOR_SCALE / 100;
+       return 1;
+}
+
+__setup("migration_factor=", setup_migration_factor);
+
+/*
+ * Estimated distance of two CPUs, measured via the number of domains
+ * we have to pass for the two CPUs to be in the same span:
+ */
+static unsigned long domain_distance(int cpu1, int cpu2)
+{
+       unsigned long distance = 0;
+       struct sched_domain *sd;
+
+       for_each_domain(cpu1, sd) {
+               WARN_ON(!cpu_isset(cpu1, sd->span));
+               if (cpu_isset(cpu2, sd->span))
+                       return distance;
+               distance++;
+       }
+       if (distance >= MAX_DOMAIN_DISTANCE) {
+               WARN_ON(1);
+               distance = MAX_DOMAIN_DISTANCE-1;
+       }
+
+       return distance;
+}
+
+static unsigned int migration_debug;
+
+static int __init setup_migration_debug(char *str)
+{
+       get_option(&str, &migration_debug);
+       return 1;
+}
+
+__setup("migration_debug=", setup_migration_debug);
+
+/*
+ * Maximum cache-size that the scheduler should try to measure.
+ * Architectures with larger caches should tune this up during
+ * bootup. Gets used in the domain-setup code (i.e. during SMP
+ * bootup).
+ */
+unsigned int max_cache_size;
+
+static int __init setup_max_cache_size(char *str)
+{
+       get_option(&str, &max_cache_size);
+       return 1;
+}
+
+__setup("max_cache_size=", setup_max_cache_size);
+
+/*
+ * Dirty a big buffer in a hard-to-predict (for the L2 cache) way. This
+ * is the operation that is timed, so we try to generate unpredictable
+ * cachemisses that still end up filling the L2 cache:
+ */
+static void touch_cache(void *__cache, unsigned long __size)
+{
+       unsigned long size = __size/sizeof(long), chunk1 = size/3,
+                       chunk2 = 2*size/3;
+       unsigned long *cache = __cache;
+       int i;
+
+       for (i = 0; i < size/6; i += 8) {
+               switch (i % 6) {
+                       case 0: cache[i]++;
+                       case 1: cache[size-1-i]++;
+                       case 2: cache[chunk1-i]++;
+                       case 3: cache[chunk1+i]++;
+                       case 4: cache[chunk2-i]++;
+                       case 5: cache[chunk2+i]++;
+               }
+       }
+}
+
+/*
+ * Measure the cache-cost of one task migration. Returns in units of nsec.
+ */
+static unsigned long long measure_one(void *cache, unsigned long size,
+                                     int source, int target)
+{
+       cpumask_t mask, saved_mask;
+       unsigned long long t0, t1, t2, t3, cost;
+
+       saved_mask = current->cpus_allowed;
+
+       /*
+        * Flush source caches to RAM and invalidate them:
+        */
+       sched_cacheflush();
+
+       /*
+        * Migrate to the source CPU:
+        */
+       mask = cpumask_of_cpu(source);
+       set_cpus_allowed(current, mask);
+       WARN_ON(smp_processor_id() != source);
+
+       /*
+        * Dirty the working set:
+        */
+       t0 = sched_clock();
+       touch_cache(cache, size);
+       t1 = sched_clock();
+
+       /*
+        * Migrate to the target CPU, dirty the L2 cache and access
+        * the shared buffer. (which represents the working set
+        * of a migrated task.)
+        */
+       mask = cpumask_of_cpu(target);
+       set_cpus_allowed(current, mask);
+       WARN_ON(smp_processor_id() != target);
+
+       t2 = sched_clock();
+       touch_cache(cache, size);
+       t3 = sched_clock();
+
+       cost = t1-t0 + t3-t2;
+
+       if (migration_debug >= 2)
+               printk("[%d->%d]: %8Ld %8Ld %8Ld => %10Ld.\n",
+                       source, target, t1-t0, t1-t0, t3-t2, cost);
+       /*
+        * Flush target caches to RAM and invalidate them:
+        */
+       sched_cacheflush();
+
+       set_cpus_allowed(current, saved_mask);
+
+       return cost;
+}
+
+/*
+ * Measure a series of task migrations and return the average
+ * result. Since this code runs early during bootup the system
+ * is 'undisturbed' and the average latency makes sense.
+ *
+ * The algorithm in essence auto-detects the relevant cache-size,
+ * so it will properly detect different cachesizes for different
+ * cache-hierarchies, depending on how the CPUs are connected.
+ *
+ * Architectures can prime the upper limit of the search range via
+ * max_cache_size, otherwise the search range defaults to 20MB...64K.
+ */
+static unsigned long long
+measure_cost(int cpu1, int cpu2, void *cache, unsigned int size)
+{
+       unsigned long long cost1, cost2;
+       int i;
+
+       /*
+        * Measure the migration cost of 'size' bytes, over an
+        * average of 10 runs:
+        *
+        * (We perturb the cache size by a small (0..4k)
+        *  value to compensate size/alignment related artifacts.
+        *  We also subtract the cost of the operation done on
+        *  the same CPU.)
+        */
+       cost1 = 0;
+
+       /*
+        * dry run, to make sure we start off cache-cold on cpu1,
+        * and to get any vmalloc pagefaults in advance:
+        */
+       measure_one(cache, size, cpu1, cpu2);
+       for (i = 0; i < ITERATIONS; i++)
+               cost1 += measure_one(cache, size - i*1024, cpu1, cpu2);
+
+       measure_one(cache, size, cpu2, cpu1);
+       for (i = 0; i < ITERATIONS; i++)
+               cost1 += measure_one(cache, size - i*1024, cpu2, cpu1);
+
+       /*
+        * (We measure the non-migrating [cached] cost on both
+        *  cpu1 and cpu2, to handle CPUs with different speeds)
+        */
+       cost2 = 0;
+
+       measure_one(cache, size, cpu1, cpu1);
+       for (i = 0; i < ITERATIONS; i++)
+               cost2 += measure_one(cache, size - i*1024, cpu1, cpu1);
+
+       measure_one(cache, size, cpu2, cpu2);
+       for (i = 0; i < ITERATIONS; i++)
+               cost2 += measure_one(cache, size - i*1024, cpu2, cpu2);
+
+       /*
+        * Get the per-iteration migration cost:
+        */
+       do_div(cost1, 2*ITERATIONS);
+       do_div(cost2, 2*ITERATIONS);
+
+       return cost1 - cost2;
+}
+
+static unsigned long long measure_migration_cost(int cpu1, int cpu2)
+{
+       unsigned long long max_cost = 0, fluct = 0, avg_fluct = 0;
+       unsigned int max_size, size, size_found = 0;
+       long long cost = 0, prev_cost;
+       void *cache;
+
+       /*
+        * Search from max_cache_size*5 down to 64K - the real relevant
+        * cachesize has to lie somewhere inbetween.
+        */
+       if (max_cache_size) {
+               max_size = max(max_cache_size * SEARCH_SCOPE, MIN_CACHE_SIZE);
+               size = max(max_cache_size / SEARCH_SCOPE, MIN_CACHE_SIZE);
+       } else {
+               /*
+                * Since we have no estimation about the relevant
+                * search range
+                */
+               max_size = DEFAULT_CACHE_SIZE * SEARCH_SCOPE;
+               size = MIN_CACHE_SIZE;
+       }
+
+       if (!cpu_online(cpu1) || !cpu_online(cpu2)) {
+               printk("cpu %d and %d not both online!\n", cpu1, cpu2);
+               return 0;
+       }
+
+       /*
+        * Allocate the working set:
+        */
+       cache = vmalloc(max_size);
+       if (!cache) {
+               printk("could not vmalloc %d bytes for cache!\n", 2*max_size);
+               return 1000000; // return 1 msec on very small boxen
+       }
+
+       while (size <= max_size) {
+               prev_cost = cost;
+               cost = measure_cost(cpu1, cpu2, cache, size);
+
+               /*
+                * Update the max:
+                */
+               if (cost > 0) {
+                       if (max_cost < cost) {
+                               max_cost = cost;
+                               size_found = size;
+                       }
+               }
+               /*
+                * Calculate average fluctuation, we use this to prevent
+                * noise from triggering an early break out of the loop:
+                */
+               fluct = abs(cost - prev_cost);
+               avg_fluct = (avg_fluct + fluct)/2;
+
+               if (migration_debug)
+                       printk("-> [%d][%d][%7d] %3ld.%ld [%3ld.%ld] (%ld): (%8Ld %8Ld)\n",
+                               cpu1, cpu2, size,
+                               (long)cost / 1000000,
+                               ((long)cost / 100000) % 10,
+                               (long)max_cost / 1000000,
+                               ((long)max_cost / 100000) % 10,
+                               domain_distance(cpu1, cpu2),
+                               cost, avg_fluct);
+
+               /*
+                * If we iterated at least 20% past the previous maximum,
+                * and the cost has dropped by more than 20% already,
+                * (taking fluctuations into account) then we assume to
+                * have found the maximum and break out of the loop early:
+                */
+               if (size_found && (size*100 > size_found*SIZE_THRESH))
+                       if (cost+avg_fluct <= 0 ||
+                               max_cost*100 > (cost+avg_fluct)*COST_THRESH) {
+
+                               if (migration_debug)
+                                       printk("-> found max.\n");
+                               break;
+                       }
+               /*
+                * Increase the cachesize in 5% steps:
+                */
+               size = size * 20 / 19;
+       }
+
+       if (migration_debug)
+               printk("[%d][%d] working set size found: %d, cost: %Ld\n",
+                       cpu1, cpu2, size_found, max_cost);
+
+       vfree(cache);
+
+       /*
+        * A task is considered 'cache cold' if at least 2 times
+        * the worst-case cost of migration has passed.
+        *
+        * (this limit is only listened to if the load-balancing
+        * situation is 'nice' - if there is a large imbalance we
+        * ignore it for the sake of CPU utilization and
+        * processing fairness.)
+        */
+       return 2 * max_cost * migration_factor / MIGRATION_FACTOR_SCALE;
+}
+
+static void calibrate_migration_costs(const cpumask_t *cpu_map)
+{
+       int cpu1 = -1, cpu2 = -1, cpu, orig_cpu = raw_smp_processor_id();
+       unsigned long j0, j1, distance, max_distance = 0;
+       struct sched_domain *sd;
+
+       j0 = jiffies;
+
+       /*
+        * First pass - calculate the cacheflush times:
+        */
+       for_each_cpu_mask(cpu1, *cpu_map) {
+               for_each_cpu_mask(cpu2, *cpu_map) {
+                       if (cpu1 == cpu2)
+                               continue;
+                       distance = domain_distance(cpu1, cpu2);
+                       max_distance = max(max_distance, distance);
+                       /*
+                        * No result cached yet?
+                        */
+                       if (migration_cost[distance] == -1LL)
+                               migration_cost[distance] =
+                                       measure_migration_cost(cpu1, cpu2);
+               }
+       }
+       /*
+        * Second pass - update the sched domain hierarchy with
+        * the new cache-hot-time estimations:
+        */
+       for_each_cpu_mask(cpu, *cpu_map) {
+               distance = 0;
+               for_each_domain(cpu, sd) {
+                       sd->cache_hot_time = migration_cost[distance];
+                       distance++;
+               }
+       }
+       /*
+        * Print the matrix:
+        */
+       if (migration_debug)
+               printk("migration: max_cache_size: %d, cpu: %d MHz:\n",
+                       max_cache_size,
+#ifdef CONFIG_X86
+                       cpu_khz/1000
+#else
+                       -1
+#endif
+               );
+       printk("migration_cost=");
+       for (distance = 0; distance <= max_distance; distance++) {
+               if (distance)
+                       printk(",");
+               printk("%ld", (long)migration_cost[distance] / 1000);
+       }
+       printk("\n");
+       j1 = jiffies;
+       if (migration_debug)
+               printk("migration: %ld seconds\n", (j1-j0)/HZ);
+
+       /*
+        * Move back to the original CPU. NUMA-Q gets confused
+        * if we migrate to another quad during bootup.
+        */
+       if (raw_smp_processor_id() != orig_cpu) {
+               cpumask_t mask = cpumask_of_cpu(orig_cpu),
+                       saved_mask = current->cpus_allowed;
+
+               set_cpus_allowed(current, mask);
+               set_cpus_allowed(current, saved_mask);
+       }
+}
+
 #ifdef CONFIG_NUMA
+
 /**
  * find_next_best_node - find the next node to include in a sched_domain
  * @node: node whose sched_domain we're building
@@ -5447,6 +5920,10 @@ next_sg:
 #endif
                cpu_attach_domain(sd, i);
        }
+       /*
+        * Tune cache-hot values:
+        */
+       calibrate_migration_costs(cpu_map);
 }
 /*
  * Set up scheduler domains and groups.  Callers must hold the hotplug lock.
index 08aa5b263f36b01c0308c11f94428b404f5c7582..1da2e74beb97240947ebe3da5a30a4c5ae81a8fe 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/posix-timers.h>
 #include <linux/signal.h>
 #include <linux/audit.h>
+#include <linux/capability.h>
 #include <asm/param.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
index b6941e06d5d507a141a135294c8d29e62ddd59d3..d09cac23fdfd6460daa501f6f549e69f762f2391 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/kexec.h>
 #include <linux/workqueue.h>
+#include <linux/capability.h>
 #include <linux/device.h>
 #include <linux/key.h>
 #include <linux/times.h>
@@ -223,6 +224,18 @@ int unregister_reboot_notifier(struct notifier_block * nb)
 
 EXPORT_SYMBOL(unregister_reboot_notifier);
 
+#ifndef CONFIG_SECURITY
+int capable(int cap)
+{
+        if (cap_raised(current->cap_effective, cap)) {
+              current->flags |= PF_SUPERPRIV;
+              return 1;
+        }
+        return 0;
+}
+EXPORT_SYMBOL(capable);
+#endif
+
 static int set_one_prio(struct task_struct *p, int niceval, int error)
 {
        int no_nice;
index 03b0598f2369d2e6cd0d67493f161c675b87b954..62d4d9566876eb9e32199c3969d61d306543d708 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/slab.h>
 #include <linux/sysctl.h>
 #include <linux/proc_fs.h>
+#include <linux/capability.h>
 #include <linux/ctype.h>
 #include <linux/utsname.h>
 #include <linux/capability.h>
index 169e8329e0b63ba59ce29f438dd90f182280ce03..7477b1d2079e32a614ea82e6ae21fde3abe48373 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <linux/module.h>
 #include <linux/timex.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
 #include <linux/syscalls.h>
index f669941e8b26d8d483d22889c9e328d3a5b6264f..aa25605027c8eb19c682cd6efec17b0d79073451 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/prctl.h>
+#include <linux/capability.h>
 #include <linux/init.h>
 #include <linux/highuid.h>
 #include <linux/security.h>
index 3b482052f4036c29338ecdf9aae91efcaa5ec2f8..0af497b6b9a87f26b395e281cfd049a76a72ca41 100644 (file)
@@ -463,7 +463,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
                 */
                dma_addr_t handle;
                handle = swiotlb_map_single(NULL, NULL, size, DMA_FROM_DEVICE);
-               if (dma_mapping_error(handle))
+               if (swiotlb_dma_mapping_error(handle))
                        return NULL;
 
                ret = phys_to_virt(handle);
index 96de772be487b7c8e6df4e591bd2f3cf9b8647ab..a965b6b35f266bce90ad5703ec4c81b7270e9d8e 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/compiler.h>
 #include <linux/fs.h>
 #include <linux/aio.h>
+#include <linux/capability.h>
 #include <linux/kernel_stat.h>
 #include <linux/mm.h>
 #include <linux/swap.h>
index 1850d0aef4ac3aba3abc99caf9b479c75319e368..b62cab575a84bb241dad5c1c91717d97a97d2c4d 100644 (file)
@@ -208,6 +208,8 @@ static int check_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
                page = vm_normal_page(vma, addr, *pte);
                if (!page)
                        continue;
+               if (PageReserved(page))
+                       continue;
                nid = page_to_nid(page);
                if (node_isset(nid, *nodes) == !!(flags & MPOL_MF_INVERT))
                        continue;
@@ -290,7 +292,7 @@ static inline int check_pgd_range(struct vm_area_struct *vma,
 static inline int vma_migratable(struct vm_area_struct *vma)
 {
        if (vma->vm_flags & (
-               VM_LOCKED|VM_IO|VM_HUGETLB|VM_PFNMAP))
+               VM_LOCKED|VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED))
                return 0;
        return 1;
 }
index 4ae3a46ff7688a4d12d0022854120be978844242..b90c59573abf5da8bd00dcc7b224796ce66befc5 100644 (file)
@@ -5,6 +5,7 @@
  *  (C) Copyright 2002 Christoph Hellwig
  */
 
+#include <linux/capability.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
 #include <linux/mempolicy.h>
index 64ba4dbcb7def44e02c278a01926b061d0417f40..47556d2b3e90ddbde4b0b8e69430ef5b3726e3af 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -13,6 +13,7 @@
 #include <linux/pagemap.h>
 #include <linux/swap.h>
 #include <linux/syscalls.h>
+#include <linux/capability.h>
 #include <linux/init.h>
 #include <linux/file.h>
 #include <linux/fs.h>
index ddaeee9a0b69e5a5e5b232377ae97801fd6a438e..1903bdf65e428d88e5bf124243d99ee7ab7c51e3 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/shm.h>
 #include <linux/mman.h>
 #include <linux/swap.h>
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/highmem.h>
 #include <linux/security.h>
index 8e363536e2da327f602a4a82d3dc36ed237919bc..8c960b469593a9a6818fa4dd9c08a4b591916c86 100644 (file)
@@ -137,9 +137,9 @@ static inline int bad_range(struct zone *zone, struct page *page)
 static void bad_page(struct page *page)
 {
        printk(KERN_EMERG "Bad page state in process '%s'\n"
-               "page:%p flags:0x%0*lx mapping:%p mapcount:%d count:%d\n"
-               "Trying to fix it up, but a reboot is needed\n"
-               "Backtrace:\n",
+               KERN_EMERG "page:%p flags:0x%0*lx mapping:%p mapcount:%d count:%d\n"
+               KERN_EMERG "Trying to fix it up, but a reboot is needed\n"
+               KERN_EMERG "Backtrace:\n",
                current->comm, page, (int)(2*sizeof(unsigned long)),
                (unsigned long)page->flags, page->mapping,
                page_mapcount(page), page_count(page));
@@ -931,7 +931,8 @@ restart:
         *
         * The caller may dip into page reserves a bit more if the caller
         * cannot run direct reclaim, or if the caller has realtime scheduling
-        * policy.
+        * policy or is asking for __GFP_HIGH memory.  GFP_ATOMIC requests will
+        * set both ALLOC_HARDER (!wait) and ALLOC_HIGH (__GFP_HIGH).
         */
        alloc_flags = ALLOC_WMARK_MIN;
        if ((unlikely(rt_task(p)) && !in_interrupt()) || !wait)
@@ -1741,7 +1742,7 @@ void __devinit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
        unsigned long end_pfn = start_pfn + size;
        unsigned long pfn;
 
-       for (pfn = start_pfn; pfn < end_pfn; pfn++, page++) {
+       for (pfn = start_pfn; pfn < end_pfn; pfn++) {
                if (!early_pfn_valid(pfn))
                        continue;
                page = pfn_to_page(pfn);
index d8a5afc8b2a3a417ade826173ce96a55f2ac0000..957fef43fa6081ec62cf3459e3b5db2d865eae57 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/rmap.h>
 #include <linux/security.h>
 #include <linux/backing-dev.h>
+#include <linux/capability.h>
 #include <linux/syscalls.h>
 
 #include <asm/pgtable.h>
index cdc6d431972b74c8aacd9e07ec32f95e73d5d55e..f9d6a9cc91c4bc806700c6119f45e34283abdeb7 100644 (file)
@@ -90,7 +90,7 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
        file->f_mode = FMODE_WRITE | FMODE_READ;
 
        /* notify everyone as to the change of file size */
-       error = do_truncate(dentry, size, file);
+       error = do_truncate(dentry, size, 0, file);
        if (error < 0)
                goto close_file;
 
index 67465b65abe4345181f1029360ac8654e189eaf0..fa76220708ce7cb068ae127c0ea35c8bd72fdfe6 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include <asm/uaccess.h> /* for copy_from_user */
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
index a5144e43aae136896ae646e4048fbdc13b75b25e..697ac55e29dc6ec6061ab3d1972dc91ec8e13c70 100644 (file)
@@ -52,6 +52,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/if_arp.h>
 #include <linux/termios.h>     /* For TIOCOUTQ/INQ */
index 1dafa9c108a75fdca35792e67e2b5c35ec8ed2ec..680ccb12aae8652d194735c0645c78a040d1f8e9 100644 (file)
@@ -18,6 +18,7 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary
 #include <net/arp.h>
 #include <linux/atm.h>
 #include <linux/atmdev.h>
+#include <linux/capability.h>
 #include <linux/seq_file.h>
 
 #include <linux/atmbr2684.h>
index 4f54c9a5e84a440b9820c3450af722848d15a80c..73370de97539421c2f11e116dbdc35a8efef7632 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/atmdev.h>
 #include <linux/atmclip.h>
 #include <linux/atmarp.h>
+#include <linux/capability.h>
 #include <linux/ip.h> /* for net/route.h */
 #include <linux/in.h> /* for struct sockaddr_in */
 #include <linux/if.h> /* for IFF_UP */
index a150198b05a3984751c13aced3cbe226314a56b4..eb109af7eb4a45b2cffef7aec1b2b146b6ea733b 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/atmdev.h>
 #include <linux/atmclip.h>     /* CLIP_*ENCAP */
 #include <linux/atmarp.h>      /* manifest constants */
+#include <linux/capability.h>
 #include <linux/sonet.h>       /* for ioctls */
 #include <linux/atmsvc.h>
 #include <linux/atmmpc.h>
index eea051338498922071b65a84304a994d110bda89..c4fc722fef9a2de2362b1b5ef52abba92d662996 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/bitops.h>
+#include <linux/capability.h>
 
 /* We are ethernet device */
 #include <linux/if_ether.h>
@@ -1811,8 +1812,7 @@ make_entry(struct lec_priv *priv, unsigned char *mac_addr)
 {
         struct lec_arp_table *to_return;
 
-        to_return = (struct lec_arp_table *) kmalloc(sizeof(struct lec_arp_table),
-                                                    GFP_ATOMIC);
+        to_return = kmalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
         if (!to_return) {
                 printk("LEC: Arp entry kmalloc failed\n");
                 return NULL;
index 36b7ae36023261ffec36bf0faf792ec4216dcf7b..c304ef1513b9bed3d8191af2224c97c50b394918 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/timer.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/capability.h>
 #include <linux/seq_file.h>
 
 /* We are an ethernet device */
index 58f4a2b5aebe482c5ddfa35b3712b39f07ff1a62..1489067c1e84474c8d958c6d829e83d06efc659a 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/skbuff.h>
 #include <linux/atm.h>
 #include <linux/atmdev.h>
+#include <linux/capability.h>
 #include <linux/ppp_defs.h>
 #include <linux/if_ppp.h>
 #include <linux/ppp_channel.h>
index 4a0466e91aa67e43fd7cc1638158374fd97c1cf3..3e57b17ca523139222e771bd49656797b2ecab4b 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/atmdev.h>
+#include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
 #include <linux/mm.h>
index c8c459fcb0386a0e597f8b2d811a08b3055a0ef8..224190537c90c3e5816df506e8dc9f234dfa5a7e 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/kernel.h> /* for barrier */
 #include <linux/module.h>
 #include <linux/bitops.h>
+#include <linux/capability.h>
 #include <linux/delay.h>
 #include <net/sock.h>   /* for struct sock */
 
index e8753c7fcad17d1464e06006af3abb96dad6ba30..dbf9b47681f72c119b217c44f4a883d1345ba6f9 100644 (file)
@@ -14,6 +14,7 @@
  * Copyright (C) Frederic Rible F1OAT (frible@teaser.fr)
  */
 #include <linux/config.h>
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/types.h>
index b1e945bd6ed3d0f22e1a306303ad32ca4a471cc6..f04f8630fd2835e61cef28562cb7e4bd12203767 100644 (file)
@@ -11,6 +11,8 @@
  * Copyright (C) Hans-Joachim Hetscher DD8NE (dd8ne@bnv-bamberg.de)
  * Copyright (C) Frederic Rible F1OAT (frible@teaser.fr)
  */
+
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
index d53cc8615865f4b2e9ea7cc82452b57ddbbcef99..b8b5854bce9ab2d35c16bb25b286bd794aa8e4e2 100644 (file)
@@ -6,6 +6,8 @@
  *
  * Copyright (C) Jonathan Naylor G4KLX (g4klx@g4klx.demon.co.uk)
  */
+
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
index ccbaf69afc5b0d000b1c389bb11ebdc33657bb9f..2bfe796cf05dfb2a21305ddd4a58fd91ebe6cc13 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/module.h>
 
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 5e22343b6090a5aabf6ad593c601ff44d89c4711..8f8fad23f78afc0f81b577f82fcbb084bbe23bfb 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 84e6c93a044ad50e934fe8aaa008b4e48354d0fc..bdb6458c6bd53e049a37041ec46dcdd46a08e545 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 8f8dd931b2948b1746c7163f97084c307442155a..b8f67761b8868ea8d01ef0f32ebf7900d68cc897 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 7f0781e4326f0cb944d6f43bc121eb9f3b695a49..f6b4a8085357a6c0973872665272118516f72816 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index f57cde78c3de1c705c52ee4a276772b6bfda0743..74368f79ee5d084e0645c6af221062567f475e47 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/tty_driver.h>
 #include <linux/tty_flip.h>
 
+#include <linux/capability.h>
 #include <linux/slab.h>
 #include <linux/skbuff.h>
 
index b8ce14b221816664d66ad21ef3aaa392f539e2f7..159fb84098241fdcc0a3a597d2d476cf80d78421 100644 (file)
@@ -13,6 +13,7 @@
  *     2 of the License, or (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/if_bridge.h>
 #include <linux/netdevice.h>
index 98cf53c81fad2f5b5b7aa74b142b0cb92868967f..6f577f16c4c0b590a67d6a8be154ac7cfec77f3b 100644 (file)
@@ -11,6 +11,7 @@
  *     2 of the License, or (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/if_bridge.h>
index 2ebdc23bbe269f131ab3fde9fb95a9c3bfee8e04..0ac0355d16dd2dea98866ceb0c69841f5a73a400 100644 (file)
@@ -11,6 +11,7 @@
  *     2 of the License, or (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/if_bridge.h>
index 9d2ef4ffe2762e90e1ff6eb87bcb83fa7eb58a2f..0248c67277eed226924a20357699535ee587ab68 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/netfilter_bridge/ebtables.h>
 #include <linux/netfilter_bridge/ebt_stp.h>
+#include <linux/etherdevice.h>
 #include <linux/module.h>
 
 #define BPDU_TYPE_CONFIG 0
index f8ffbf6e23336a7ec184b1358d388ff42c55b28c..00729b3604f8b540e507f74e0aabf4cf6e06fa96 100644 (file)
@@ -944,7 +944,7 @@ static int do_replace(void __user *user, unsigned int len)
        if (countersize)
                memset(newinfo->counters, 0, countersize);
 
-       newinfo->entries = (char *)vmalloc(tmp.entries_size);
+       newinfo->entries = vmalloc(tmp.entries_size);
        if (!newinfo->entries) {
                ret = -ENOMEM;
                goto free_newinfo;
@@ -1146,7 +1146,7 @@ int ebt_register_table(struct ebt_table *table)
        if (!newinfo)
                return -ENOMEM;
 
-       newinfo->entries = (char *)vmalloc(table->table->entries_size);
+       newinfo->entries = vmalloc(table->table->entries_size);
        if (!(newinfo->entries))
                goto free_newinfo;
 
index bf66b114d3c235b24457bc588d34a12e60b7ffd5..fd070a098f20656027dca9c38a3b7a43a0ad1082 100644 (file)
@@ -75,6 +75,7 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <linux/bitops.h>
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/cpu.h>
 #include <linux/types.h>
index cb530eef0e3990f2f3fce1076b2660b5109555b7..05d60850840e07a0d0beba51baf2b53fb622a883 100644 (file)
@@ -158,7 +158,7 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
        int err = 0;
        struct dev_mc_list *dmi, *dmi1;
 
-       dmi1 = (struct dev_mc_list *)kmalloc(sizeof(*dmi), GFP_ATOMIC);
+       dmi1 = kmalloc(sizeof(*dmi), GFP_ATOMIC);
 
        spin_lock_bh(&dev->xmit_lock);
        for (dmi = dev->mc_list; dmi != NULL; dmi = dmi->next) {
index c5deb365525782cdfe16ba5c9438e60cf03ff069..cf581407538c4b160947548b0fa350840b959dd0 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <net/dst.h>
@@ -457,7 +458,7 @@ void divert_frame(struct sk_buff *skb)
        unsigned char                   *skb_data_end = skb->data + skb->len;
 
        /* Packet is already aimed at us, return */
-       if (!compare_ether_addr(eth, skb->dev->dev_addr))
+       if (!compare_ether_addr(eth->h_dest, skb->dev->dev_addr))
                return;
        
        /* proto is not IP, do nothing */
index 0350586e91956d230483d82d417938c39cf90805..e6f76106a99b3929c8c56ec5a62a64103b9d0c6b 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/ethtool.h>
 #include <linux/netdevice.h>
index 58adaf208dd63b1ae7e46a59757865bcf3b115ae..e8b2acbc8ea2b0473415c938db3f45e3b9233304 100644 (file)
@@ -9,6 +9,7 @@
  *     2 of the License, or (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
index 631056d44b7b15c4df833bde04da8244820dc8d2..39063122fbb7383ab1b8cf2f569fac285ca4e15f 100644 (file)
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
-#include <linux/sched.h>
 #include <linux/unistd.h>
 #include <linux/string.h>
 #include <linux/ptrace.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
+#include <linux/capability.h>
 #include <linux/delay.h>
 #include <linux/timer.h>
 #include <linux/init.h>
index e887d19be506f51e8625d4dbc8b63c1c3e367030..649d01ef35b6dc4dca5f3b74b593e7f5bfc272d2 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/module.h>
 #include <linux/signal.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
index 6465b0e4c8cbe734190e01052703de66d8ed29c8..6e00811d44bc810a8e7d6cf64585a520dc60fce2 100644 (file)
@@ -91,6 +91,7 @@
  *             2 of the License, or (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
index 78ec5344be86e6f65f2c02121a84145bf4bc1cfc..ce4aaf94860dd52dfe94f9bc179ac18314b53c4f 100644 (file)
@@ -122,6 +122,7 @@ Version 0.0.6    2.1.110   07-aug-98   Eduardo Marcelo Serrat
 #include <net/flow.h>
 #include <asm/system.h>
 #include <asm/ioctls.h>
+#include <linux/capability.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
 #include <linux/proc_fs.h>
index 5610bb16dbf941db2307076b31f9a8e8914c70bf..efbead83ba7fe81617131742a824205ab2c8da80 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
index 966a071a408c86203985917886d0dcf2360abcf2..97c276f95b35ecfe950ddd43140770705fcd6b51 100644 (file)
@@ -79,6 +79,7 @@
 #include <linux/string.h>
 #include <linux/sockios.h>
 #include <linux/net.h>
+#include <linux/capability.h>
 #include <linux/fcntl.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
index 37432088fe6d3d97c353d6491d31e6bd404d7862..accdefedfed72654eba15e642d87630ddb090d9b 100644 (file)
@@ -79,6 +79,7 @@
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/socket.h>
 #include <linux/sockios.h>
index 7b9bb28e2ee9587a7c287f616f36f93d80b2b7cb..95b9d81ac488659808a93d289ddea362294a170c 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <linux/bitops.h>
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
index 18f5e509281a29f2b52e296a7622bc7d934c45c9..5b25fc0d980c98655dc20814f0ba432cffcbb9e9 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <linux/bitops.h>
+#include <linux/capability.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 34758118c10ca4a791ab80764b003bec60f50707..192092b89e534732ae8ab1eb6f62015ecfb2f2a1 100644 (file)
@@ -975,7 +975,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im)
         * for deleted items allows change reports to use common code with
         * non-deleted or query-response MCA's.
         */
-       pmc = (struct ip_mc_list *)kmalloc(sizeof(*pmc), GFP_KERNEL);
+       pmc = kmalloc(sizeof(*pmc), GFP_KERNEL);
        if (!pmc)
                return;
        memset(pmc, 0, sizeof(*pmc));
@@ -1155,7 +1155,7 @@ void ip_mc_inc_group(struct in_device *in_dev, u32 addr)
                }
        }
 
-       im = (struct ip_mc_list *)kmalloc(sizeof(*im), GFP_KERNEL);
+       im = kmalloc(sizeof(*im), GFP_KERNEL);
        if (!im)
                goto out;
 
@@ -1476,7 +1476,7 @@ static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode,
                psf_prev = psf;
        }
        if (!psf) {
-               psf = (struct ip_sf_list *)kmalloc(sizeof(*psf), GFP_ATOMIC);
+               psf = kmalloc(sizeof(*psf), GFP_ATOMIC);
                if (!psf)
                        return -ENOBUFS;
                memset(psf, 0, sizeof(*psf));
@@ -1659,7 +1659,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
        err = -ENOBUFS;
        if (count >= sysctl_igmp_max_memberships)
                goto done;
-       iml = (struct ip_mc_socklist *)sock_kmalloc(sk,sizeof(*iml),GFP_KERNEL);
+       iml = sock_kmalloc(sk,sizeof(*iml),GFP_KERNEL);
        if (iml == NULL)
                goto done;
 
@@ -1823,8 +1823,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
 
                if (psl)
                        count += psl->sl_max;
-               newpsl = (struct ip_sf_socklist *)sock_kmalloc(sk,
-                       IP_SFLSIZE(count), GFP_KERNEL);
+               newpsl = sock_kmalloc(sk, IP_SFLSIZE(count), GFP_KERNEL);
                if (!newpsl) {
                        err = -ENOBUFS;
                        goto done;
@@ -1907,8 +1906,8 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
                goto done;
        }
        if (msf->imsf_numsrc) {
-               newpsl = (struct ip_sf_socklist *)sock_kmalloc(sk,
-                               IP_SFLSIZE(msf->imsf_numsrc), GFP_KERNEL);
+               newpsl = sock_kmalloc(sk, IP_SFLSIZE(msf->imsf_numsrc),
+                                                          GFP_KERNEL);
                if (!newpsl) {
                        err = -ENOBUFS;
                        goto done;
index 1e93eafa7af1cda1e48a160f1b8857094c55f439..abe23923e4e73975bd6ae486a7ef1c8ce89fb2a9 100644 (file)
@@ -10,6 +10,7 @@
  *
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
index d3f6c468faf43ac20e4a8e56e1d5325ca96f14e0..9bebad07bf2ec4baea772a654e7d37808504928c 100644 (file)
@@ -11,6 +11,7 @@
  *             
  */
 
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <asm/uaccess.h>
index 6986e11d65cca0fb6f94383076e902ac8eb23a78..2bf8d782f678b6add07c5d193902667006ccd96d 100644 (file)
@@ -621,7 +621,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
                                err = -ENOBUFS;
                                break;
                        }
-                       msf = (struct ip_msfilter *)kmalloc(optlen, GFP_KERNEL);
+                       msf = kmalloc(optlen, GFP_KERNEL);
                        if (msf == 0) {
                                err = -ENOBUFS;
                                break;
@@ -778,7 +778,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
                                err = -ENOBUFS;
                                break;
                        }
-                       gsf = (struct group_filter *)kmalloc(optlen,GFP_KERNEL);
+                       gsf = kmalloc(optlen,GFP_KERNEL);
                        if (gsf == 0) {
                                err = -ENOBUFS;
                                break;
@@ -798,7 +798,7 @@ int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
                                goto mc_msf_out;
                        }
                        msize = IP_MSFILTER_SIZE(gsf->gf_numsrc);
-                       msf = (struct ip_msfilter *)kmalloc(msize,GFP_KERNEL);
+                       msf = kmalloc(msize,GFP_KERNEL);
                        if (msf == 0) {
                                err = -ENOBUFS;
                                goto mc_msf_out;
index bc5ca23b2646a96de9fa5e8c15b7a159229f7851..e5cbe72c6b80bd0e858fb3af17a674e315e3a517 100644 (file)
@@ -93,6 +93,7 @@
  */
 
  
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
index f58ac9854c3f705c91a9e9654b270fc4f4010b40..5c94c222e3f382a3fce0f9d4efb0e05fa29d9056 100644 (file)
@@ -33,6 +33,7 @@
 #include <asm/uaccess.h>
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/timer.h>
 #include <linux/mm.h>
index c935c5086d3351af11542845ebcd8371dfef91b0..7f0288b25fa16e77e017665e8788a0d20d98c5d9 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/types.h>
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/sysctl.h>
 #include <linux/proc_fs.h>
index bba15630469599b7a4d93d32baf03f86b93d1e20..b6d5284c8020760685bcbf529e65525a915b8af4 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
+#include <linux/capability.h>
 #include <linux/if_arp.h>
 #include <linux/kmod.h>
 #include <linux/vmalloc.h>
index 4108a5e12b3c3d702bcd8211533ac4bee00ea3f7..d716bba798f2eee416f936ed0bf49512e2107ba7 100644 (file)
@@ -762,7 +762,7 @@ static struct ip_conntrack_helper pptp = {
        .help = conntrack_pptp_help
 };
 
-extern void __exit ip_ct_proto_gre_fini(void);
+extern void ip_ct_proto_gre_fini(void);
 extern int __init ip_ct_proto_gre_init(void);
 
 /* ip_conntrack_pptp initialization */
index 57956dee60c8d354861debd7c1e8f75c97e59e52..c777abf16cb7a99573a2a9d841b96c9fe8f6f4e5 100644 (file)
@@ -309,7 +309,10 @@ int __init ip_ct_proto_gre_init(void)
        return ip_conntrack_protocol_register(&gre);
 }
 
-void __exit ip_ct_proto_gre_fini(void)
+/* This cannot be __exit, as it is invoked from ip_conntrack_helper_pptp.c's
+ * init() code on errors.
+ */
+void ip_ct_proto_gre_fini(void)
 {
        struct list_head *pos, *n;
 
index 2a26d167e1495774e3c7941ced08f39db0398397..877bc96d333684fae54d3af394d2e13aaf73d598 100644 (file)
@@ -14,6 +14,7 @@
  */
 #include <linux/config.h>
 #include <linux/cache.h>
+#include <linux/capability.h>
 #include <linux/skbuff.h>
 #include <linux/kmod.h>
 #include <linux/vmalloc.h>
index e53e421eeee94b3ecdb842ccd4b1d0d24c4c3b58..7129d423975561c0eb0b3195651929a15c5ea6f8 100644 (file)
@@ -58,6 +58,7 @@
 #ifdef CONFIG_SYSCTL
 #include <linux/sysctl.h>
 #endif
+#include <linux/capability.h>
 #include <linux/delay.h>
 #include <linux/notifier.h>
 #include <linux/string.h>
index 25c3fe5005d9f6a9753e131825169e8fb7dd0f9a..064ffab82a9fe5f7d674bc344e0798b6f97e62ec 100644 (file)
@@ -22,6 +22,7 @@
 
 
 #include <linux/module.h>
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
index 6b7294047238387ea6c20420938f8b46990c057b..65e73ac0d6d0d5603c1466d9780058a80a377b95 100644 (file)
@@ -13,6 +13,7 @@
  *      2 of the License, or (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/errno.h>
index c4a3a993acb7ba5945f422bfa27c7b97d45376e0..99a6eb23378bcc2d3b079ce3bc5ff7efd8e9ff58 100644 (file)
@@ -13,6 +13,7 @@
  *      2 of the License, or (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
index 89d12b4817a9fddec6254c24cf5c93f231a7dec5..964ad9d1276d56f01a47d83eeec3ffb54447ff48 100644 (file)
@@ -9,6 +9,7 @@
  *     Authors:        Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
index c3c2bf699a67259a9e1608e54e6f29f614dc2487..92ead3cf956b1d27817f98a084cdd43d3cc7fb20 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/sockios.h>
index c63868dd2ca29c711e3153234578bc8368f4d8d7..f7142ba519abc5a195eb532a1643e0f9e5461056 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
@@ -549,7 +550,7 @@ done:
                        retv = -ENOBUFS;
                        break;
                }
-               gsf = (struct group_filter *)kmalloc(optlen,GFP_KERNEL);
+               gsf = kmalloc(optlen,GFP_KERNEL);
                if (gsf == 0) {
                        retv = -ENOBUFS;
                        break;
index 1cf305a9f8ddf4067e6e9529c86eb71b25e3a349..cc3e9f5608671d4726816551c9320c80c377d494 100644 (file)
@@ -449,8 +449,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
 
                if (psl)
                        count += psl->sl_max;
-               newpsl = (struct ip6_sf_socklist *)sock_kmalloc(sk,
-                       IP6_SFLSIZE(count), GFP_ATOMIC);
+               newpsl = sock_kmalloc(sk, IP6_SFLSIZE(count), GFP_ATOMIC);
                if (!newpsl) {
                        err = -ENOBUFS;
                        goto done;
@@ -535,8 +534,8 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
                goto done;
        }
        if (gsf->gf_numsrc) {
-               newpsl = (struct ip6_sf_socklist *)sock_kmalloc(sk,
-                               IP6_SFLSIZE(gsf->gf_numsrc), GFP_ATOMIC);
+               newpsl = sock_kmalloc(sk, IP6_SFLSIZE(gsf->gf_numsrc),
+                                                         GFP_ATOMIC);
                if (!newpsl) {
                        err = -ENOBUFS;
                        goto done;
@@ -768,7 +767,7 @@ static void mld_add_delrec(struct inet6_dev *idev, struct ifmcaddr6 *im)
         * for deleted items allows change reports to use common code with
         * non-deleted or query-response MCA's.
         */
-       pmc = (struct ifmcaddr6 *)kmalloc(sizeof(*pmc), GFP_ATOMIC);
+       pmc = kmalloc(sizeof(*pmc), GFP_ATOMIC);
        if (!pmc)
                return;
        memset(pmc, 0, sizeof(*pmc));
@@ -1937,7 +1936,7 @@ static int ip6_mc_add1_src(struct ifmcaddr6 *pmc, int sfmode,
                psf_prev = psf;
        }
        if (!psf) {
-               psf = (struct ip6_sf_list *)kmalloc(sizeof(*psf), GFP_ATOMIC);
+               psf = kmalloc(sizeof(*psf), GFP_ATOMIC);
                if (!psf)
                        return -ENOBUFS;
                memset(psf, 0, sizeof(*psf));
index 925b42d48347c9ffc5285ba6ff83460652f8be85..1390370186d975ff1c98bab91d65ee0ca85985b9 100644 (file)
@@ -14,6 +14,8 @@
  * 06 Jun 2002 Andras Kis-Szabo <kisza@sch.bme.hu>
  *      - new extension header parser code
  */
+
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/in.h>
 #include <linux/skbuff.h>
index ae0b09291d1750900fed84d34b13ddbe3abf1999..c848152315bc3d2b35c3b0237f2f83fab1dd7657 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/if_ether.h>
+#include <linux/etherdevice.h>
 
 #include <linux/netfilter_ipv6/ip6t_mac.h>
 #include <linux/netfilter_ipv6/ip6_tables.h>
index 66140f13d1197130c29f5d9fa90c4f10a3bf3819..e0d3ad02ffb5afc5d412da05c7986942e7780685 100644 (file)
@@ -24,6 +24,7 @@
  *             reachable.  otherwise, round-robin the list.
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/types.h>
index 0dae48aa1ceca4d919ce3667ae71d9e7923af957..c2d3e17beae60cc1b2dcfdf4e4d46c7d57b12d05 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
index a25f4e8a8adae03aa9d08afb7d1c33defdc87ba2..66d04004afdaec2a731d953752fb970f17121112 100644 (file)
@@ -67,6 +67,9 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 
+/* Socket used for sending RSTs and ACKs */
+static struct socket *tcp6_socket;
+
 static void    tcp_v6_send_reset(struct sk_buff *skb);
 static void    tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req);
 static void    tcp_v6_send_check(struct sock *sk, int len, 
@@ -611,7 +614,7 @@ static void tcp_v6_send_reset(struct sk_buff *skb)
        if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) {
 
                if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) {
-                       ip6_xmit(NULL, buff, &fl, NULL, 0);
+                       ip6_xmit(tcp6_socket->sk, buff, &fl, NULL, 0);
                        TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
                        TCP_INC_STATS_BH(TCP_MIB_OUTRSTS);
                        return;
@@ -675,7 +678,7 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
 
        if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) {
                if (xfrm_lookup(&buff->dst, &fl, NULL, 0) >= 0) {
-                       ip6_xmit(NULL, buff, &fl, NULL, 0);
+                       ip6_xmit(tcp6_socket->sk, buff, &fl, NULL, 0);
                        TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
                        return;
                }
@@ -1600,8 +1603,21 @@ static struct inet_protosw tcpv6_protosw = {
 
 void __init tcpv6_init(void)
 {
+       int err;
+
        /* register inet6 protocol */
        if (inet6_add_protocol(&tcpv6_protocol, IPPROTO_TCP) < 0)
                printk(KERN_ERR "tcpv6_init: Could not register protocol\n");
        inet6_register_protosw(&tcpv6_protosw);
+
+       err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_TCP, &tcp6_socket);
+       if (err < 0)
+               panic("Failed to create the TCPv6 control socket.\n");
+       tcp6_socket->sk->sk_allocation = GFP_ATOMIC;
+
+       /* Unhash it so that IP input processing does not even
+        * see it, we do not wish this socket to see incoming
+        * packets.
+        */
+       tcp6_socket->sk->sk_prot->unhash(tcp6_socket->sk);
 }
index 0dc519b404042c25b1e25a912762ae5ed2d162c0..0fb513a34d11acc84f239545faa65b9a9a0eb9da 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/if_arp.h>
 #include <linux/if_ether.h>
index fbfa96754417cbf18f3b8bace4577394806b6e9f..759445648667a8e178a6b6481e8021ab73e73ca7 100644 (file)
@@ -43,6 +43,7 @@
  ********************************************************************/
 
 #include <linux/config.h>
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/socket.h>
index 70543d89438b8d7b4007b26102e8b11ca484e6a3..890bac0d4a56a310d530156aaf89501fee7c8b4a 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/string.h>
 #include <linux/proc_fs.h>
 #include <linux/skbuff.h>
+#include <linux/capability.h>
 #include <linux/if.h>
 #include <linux/if_ether.h>
 #include <linux/if_arp.h>
index 75f2666e863056d7255875285c5188fee69042cd..c6d169fbdceb7f16521a797a029f7ea33f95af1f 100644 (file)
@@ -82,8 +82,7 @@ struct ias_object *irias_new_object( char *name, int id)
 
        IRDA_DEBUG( 4, "%s()\n", __FUNCTION__);
 
-       obj = (struct ias_object *) kmalloc(sizeof(struct ias_object),
-                                           GFP_ATOMIC);
+       obj = kmalloc(sizeof(struct ias_object), GFP_ATOMIC);
        if (obj == NULL) {
                IRDA_WARNING("%s(), Unable to allocate object!\n",
                             __FUNCTION__);
@@ -348,8 +347,7 @@ void irias_add_integer_attrib(struct ias_object *obj, char *name, int value,
        IRDA_ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
        IRDA_ASSERT(name != NULL, return;);
 
-       attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
-                                              GFP_ATOMIC);
+       attrib = kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC);
        if (attrib == NULL) {
                IRDA_WARNING("%s: Unable to allocate attribute!\n",
                             __FUNCTION__);
@@ -385,8 +383,7 @@ void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
        IRDA_ASSERT(name != NULL, return;);
        IRDA_ASSERT(octets != NULL, return;);
 
-       attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
-                                              GFP_ATOMIC);
+       attrib = kmalloc(sizeof(struct ias_attrib), GFP_ATOMIC);
        if (attrib == NULL) {
                IRDA_WARNING("%s: Unable to allocate attribute!\n",
                             __FUNCTION__);
@@ -420,8 +417,7 @@ void irias_add_string_attrib(struct ias_object *obj, char *name, char *value,
        IRDA_ASSERT(name != NULL, return;);
        IRDA_ASSERT(value != NULL, return;);
 
-       attrib = (struct ias_attrib *) kmalloc(sizeof( struct ias_attrib),
-                                              GFP_ATOMIC);
+       attrib = kmalloc(sizeof( struct ias_attrib), GFP_ATOMIC);
        if (attrib == NULL) {
                IRDA_WARNING("%s: Unable to allocate attribute!\n",
                             __FUNCTION__);
index b391cb3893d4852c57374eef08b95bd79daac3b1..e4fe1e80029c55cdb89a0b7d5c47763fda282f24 100644 (file)
 #include <linux/netdevice.h>
 #include <linux/miscdevice.h>
 #include <linux/poll.h>
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/ctype.h>       /* isspace() */
 #include <asm/uaccess.h>
index 4c2f6d694f883341f41fca5e718abc65d3d897a7..43f1ce74187d524122d8fbf6d325c7395dfb534d 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 #include <linux/config.h>
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/socket.h>
index bb50c8a9fcad51b4539e5866a2ce10a427a14d70..2101b45d2ec6bc2be9d4f6f46c563ccf9f58a156 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/config.h>
 #include <linux/module.h>
 
+#include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/signal.h>
index 63b0e4afeb3342da4cdda6d63e95c4053872564a..d44981f5a6195b4a017552b16e5a4ca82db98c88 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
index f69e5ed9bd060b55f29212938d6f97efb27061bf..ee93abc71cb8aaefde9f24bbd6a5e5326fc5aee3 100644 (file)
@@ -53,6 +53,7 @@
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/capability.h>
 #include <linux/fcntl.h>
 #include <linux/socket.h>
 #include <linux/in.h>
@@ -1237,7 +1238,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq)
                goto done;
 
        err = -ENOBUFS;
-       i = (struct packet_mclist *)kmalloc(sizeof(*i), GFP_KERNEL);
+       i = kmalloc(sizeof(*i), GFP_KERNEL);
        if (i == NULL)
                goto done;
 
index 63090be2315a9c7a0c7ab30bc5d354f7c35a6385..ea65396d1619a5344b6b1c742dd4575dbf8a0088 100644 (file)
@@ -9,7 +9,9 @@
  * Copyright (C) Terry Dawson VK2KTJ (terry@animats.net)
  * Copyright (C) Tomi Manninen OH2BNS (oh2bns@sral.fi)
  */
+
 #include <linux/config.h>
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
index 55cd5327fbd79e4c75ff45152e0c0c20d5b1552d..8a260d43ceef156d89389aa1dbb388f93c0c7a91 100644 (file)
@@ -411,7 +411,7 @@ config NET_EMATCH_META
        tristate "Metadata"
        depends on NET_EMATCH
        ---help---
-         Say Y here if you want to be ablt to classify packets based on
+         Say Y here if you want to be able to classify packets based on
          metadata such as load average, netfilter attributes, socket
          attributes and routing decisions.
 
index 64b047c65568cafe0912b92f7bb18b7e56031c25..5cb956b721e8e05a452262decdc114061cb0a0a0 100644 (file)
@@ -92,7 +92,6 @@
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
 #include <net/pkt_cls.h>
-#include <config/net/ematch/stack.h>
 
 static LIST_HEAD(ematch_ops);
 static DEFINE_RWLOCK(ematch_mod_lock);
index f9573eba5c7aa2f5507c12c0ff55a75e0e700490..556c495c6922587e3f449957ee2b536860674d86 100644 (file)
@@ -1287,7 +1287,7 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
                        - (bodysize % SCTP_COOKIE_MULTIPLE);
        *cookie_len = headersize + bodysize;
 
-       retval = (sctp_cookie_param_t *)kmalloc(*cookie_len, GFP_ATOMIC);
+       retval = kmalloc(*cookie_len, GFP_ATOMIC);
 
        if (!retval) {
                *cookie_len = 0;
index fc04d185fa3348d8dabc2387f5465b59d3d81b97..c98ee375ba5e11883bb2df13378b450b11f77ff0 100644 (file)
@@ -63,6 +63,7 @@
 #include <linux/wait.h>
 #include <linux/time.h>
 #include <linux/ip.h>
+#include <linux/capability.h>
 #include <linux/fcntl.h>
 #include <linux/poll.h>
 #include <linux/init.h>
@@ -860,7 +861,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk,
                return -EFAULT;
 
        /* Alloc space for the address array in kernel memory.  */
-       kaddrs = (struct sockaddr *)kmalloc(addrs_size, GFP_KERNEL);
+       kaddrs = kmalloc(addrs_size, GFP_KERNEL);
        if (unlikely(!kaddrs))
                return -ENOMEM;
 
@@ -1150,7 +1151,7 @@ SCTP_STATIC int sctp_setsockopt_connectx(struct sock* sk,
                return -EFAULT;
 
        /* Alloc space for the address array in kernel memory.  */
-       kaddrs = (struct sockaddr *)kmalloc(addrs_size, GFP_KERNEL);
+       kaddrs = kmalloc(addrs_size, GFP_KERNEL);
        if (unlikely(!kaddrs))
                return -ENOMEM;
 
index 06fa217f58a99cb93b72b28ca99e85b7dc3739cd..b38a263853c32038b07fe7dcb9dae457d4456722 100644 (file)
@@ -993,7 +993,7 @@ static int sock_fasync(int fd, struct file *filp, int on)
 
        if (on)
        {
-               fna=(struct fasync_struct *)kmalloc(sizeof(struct fasync_struct), GFP_KERNEL);
+               fna = kmalloc(sizeof(struct fasync_struct), GFP_KERNEL);
                if(fna==NULL)
                        return -ENOMEM;
        }
index 8c7756036e95847f6ae2eaf1ef75fac65c3fe4a6..9ac1b8c26c01184595f34de62db8ef23b15c6890 100644 (file)
@@ -94,7 +94,7 @@ rpcauth_init_credcache(struct rpc_auth *auth, unsigned long expire)
        struct rpc_cred_cache *new;
        int i;
 
-       new = (struct rpc_cred_cache *)kmalloc(sizeof(*new), GFP_KERNEL);
+       new = kmalloc(sizeof(*new), GFP_KERNEL);
        if (!new)
                return -ENOMEM;
        for (i = 0; i < RPC_CREDCACHE_NR; i++)
index 890fb5ea0dcbf29fcc9af5e56e7c8c356b09d4b4..1b3ed4fd198735e332b3f8f46492956f91457860 100644 (file)
@@ -70,7 +70,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
        dprintk("RPC:      allocating UNIX cred for uid %d gid %d\n",
                                acred->uid, acred->gid);
 
-       if (!(cred = (struct unx_cred *) kmalloc(sizeof(*cred), GFP_KERNEL)))
+       if (!(cred = kmalloc(sizeof(*cred), GFP_KERNEL)))
                return ERR_PTR(-ENOMEM);
 
        atomic_set(&cred->uc_count, 1);
index 4cef7fa2b740d838093614037a78053a7c462f3e..d2f0550c4ba03709f23a3b3dc9f5252105f4aad8 100644 (file)
@@ -118,7 +118,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
                goto out_err;
 
        err = -ENOMEM;
-       clnt = (struct rpc_clnt *) kmalloc(sizeof(*clnt), GFP_KERNEL);
+       clnt = kmalloc(sizeof(*clnt), GFP_KERNEL);
        if (!clnt)
                goto out_err;
        memset(clnt, 0, sizeof(*clnt));
@@ -225,7 +225,7 @@ rpc_clone_client(struct rpc_clnt *clnt)
 {
        struct rpc_clnt *new;
 
-       new = (struct rpc_clnt *)kmalloc(sizeof(*new), GFP_KERNEL);
+       new = kmalloc(sizeof(*new), GFP_KERNEL);
        if (!new)
                goto out_no_clnt;
        memcpy(new, clnt, sizeof(*new));
index a8bd34d47425460a75ba871356625a13203865e6..b08419e1fc68456c545575a2a8505923729161ed 100644 (file)
@@ -32,7 +32,7 @@ svc_create(struct svc_program *prog, unsigned int bufsize)
        int vers;
        unsigned int xdrsize;
 
-       if (!(serv = (struct svc_serv *) kmalloc(sizeof(*serv), GFP_KERNEL)))
+       if (!(serv = kmalloc(sizeof(*serv), GFP_KERNEL)))
                return NULL;
        memset(serv, 0, sizeof(*serv));
        serv->sv_name      = prog->pg_name;
index 7a43ae4721edd95fd6748974f68b8cf40c2f5e7b..8b9bf4a763b55408e3449aa6a0aa4c2a6d80be4d 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/capability.h>
 #include <linux/fcntl.h>
 #include <linux/socket.h>
 #include <linux/in.h>
index bcf7b3faa76a4020d6308f5998fead39cce7b961..c34833dc7cc161f6664f8a487e4162b871606fae 100644 (file)
@@ -44,6 +44,7 @@
 
 #include <linux/config.h>
 #include <linux/stddef.h>      /* offsetof(), etc. */
+#include <linux/capability.h>
 #include <linux/errno.h>       /* return codes */
 #include <linux/kernel.h>
 #include <linux/init.h>
index bfabaf9cba873fa1739460e8dc08dc91f5237bf9..72b6ff3299ba38971693b08964ac0d546079f192 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/capability.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 04c12f58d656200b29c1e0c60c31e7ac62349741..8a6e097f99ea677acf091800f4bd3797975f9f75 100644 (file)
@@ -7,6 +7,7 @@
  *
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
index a15c54709fdefe69defdd67c49340e2485d65006..f1a5bd98bf10c3ed56d82ddea1ce33cf5a0bc905 100644 (file)
@@ -14,6 +14,7 @@
 
 #undef DEBUG
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
index 3d2ebae029c1775b49722314b2def71bc4aabe9d..90db5c76cf6e5bdad2778f6a18e6a772dd281c51 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/syscalls.h>
 #include <linux/keyctl.h>
 #include <linux/fs.h>
+#include <linux/capability.h>
 #include <linux/err.h>
 #include <asm/uaccess.h>
 #include "internal.h"
index ed5fb80769c3731003cec9ea07a41001a3c72bf2..f693e1f66b98521c3c6e0995a5c6182935b1b18a 100644 (file)
@@ -11,6 +11,7 @@
  *     (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
index 222014cafc1a9050c5670b28e55a2ebc5a1c91c9..a1b0b92af4b5acfdcf5c7e60aa75008604cf9db7 100644 (file)
@@ -270,7 +270,6 @@ extern int dmasound_catchRadius;
 #define SW_INPUT_VOLUME_SCALE  4
 #define SW_INPUT_VOLUME_DEFAULT        (128 / SW_INPUT_VOLUME_SCALE)
 
-extern int expand_bal; /* Balance factor for expanding (not volume!) */
 extern int expand_read_bal;    /* Balance factor for reading */
 extern uint software_input_volume; /* software implemented recording volume! */
 
index 59eb53f893184a22a26a2fa52b2bca055179c758..dc31373069a5f3231fa1a7bb044e99e8dd3b08af 100644 (file)
@@ -67,46 +67,46 @@ static int expand_data;     /* Data for expanding */
  * ++geert: split in even more functions (one per format)
  */
 
-static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_law(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft);
-static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s8(const u_char __user *userPtr, size_t userCount,
                         u_char frame[], ssize_t *frameUsed,
                         ssize_t frameLeft);
-static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u8(const u_char __user *userPtr, size_t userCount,
                         u_char frame[], ssize_t *frameUsed,
                         ssize_t frameLeft);
-static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s16be(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft);
-static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u16be(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft);
-static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s16le(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft);
-static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u16le(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft);
-static ssize_t ata_ctx_law(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_law(const u_char __user *userPtr, size_t userCount,
                           u_char frame[], ssize_t *frameUsed,
                           ssize_t frameLeft);
-static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft);
-static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft);
-static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s16be(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft);
-static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u16be(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft);
-static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s16le(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft);
-static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u16le(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft);
 
@@ -151,7 +151,7 @@ static int FalconStateInfo(char *buffer, size_t space);
 /*** Translations ************************************************************/
 
 
-static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_law(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft)
 {
@@ -176,7 +176,7 @@ static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s8(const u_char __user *userPtr, size_t userCount,
                         u_char frame[], ssize_t *frameUsed,
                         ssize_t frameLeft)
 {
@@ -194,7 +194,7 @@ static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u8(const u_char __user *userPtr, size_t userCount,
                         u_char frame[], ssize_t *frameUsed,
                         ssize_t frameLeft)
 {
@@ -217,8 +217,9 @@ static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        *p++ = data ^ 0x8080;
                        count--;
                }
@@ -228,7 +229,7 @@ static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s16be(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -240,8 +241,9 @@ static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        *p++ = data;
                        *p++ = data;
                        count--;
@@ -259,7 +261,7 @@ static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u16be(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -271,8 +273,9 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        data ^= 0x8000;
                        *p++ = data;
                        *p++ = data;
@@ -284,9 +287,10 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
                count = min_t(unsigned long, userCount, frameLeft)>>2;
                used = count*4;
                while (count > 0) {
-                       u_long data;
-                       if (get_user(data, ((u_int *)userPtr)++))
+                       u_int data;
+                       if (get_user(data, (u_int __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 4;
                        *p++ = data ^ 0x80008000;
                        count--;
                }
@@ -296,7 +300,7 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_s16le(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -309,8 +313,9 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        data = le2be16(data);
                        *p++ = data;
                        *p++ = data;
@@ -323,8 +328,9 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
                used = count*4;
                while (count > 0) {
                        u_long data;
-                       if (get_user(data, ((u_int *)userPtr)++))
+                       if (get_user(data, (u_int __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 4;
                        data = le2be16dbl(data);
                        *p++ = data;
                        count--;
@@ -335,7 +341,7 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ct_u16le(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -348,8 +354,9 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
                used = count*2;
                while (count > 0) {
                        u_short data;
-                       if (get_user(data, ((u_short *)userPtr)++))
+                       if (get_user(data, (u_short __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 2;
                        data = le2be16(data) ^ 0x8000;
                        *p++ = data;
                        *p++ = data;
@@ -361,8 +368,9 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
                used = count;
                while (count > 0) {
                        u_long data;
-                       if (get_user(data, ((u_int *)userPtr)++))
+                       if (get_user(data, (u_int __user *)userPtr))
                                return -EFAULT;
+                       userPtr += 4;
                        data = le2be16dbl(data) ^ 0x80008000;
                        *p++ = data;
                        count--;
@@ -373,7 +381,7 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_law(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_law(const u_char __user *userPtr, size_t userCount,
                           u_char frame[], ssize_t *frameUsed,
                           ssize_t frameLeft)
 {
@@ -435,7 +443,7 @@ static ssize_t ata_ctx_law(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft)
 {
@@ -470,8 +478,9 @@ static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                userCount -= 2;
                                bal += hSpeed;
                        }
@@ -488,7 +497,7 @@ static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft)
 {
@@ -524,8 +533,9 @@ static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                data ^= 0x8080;
                                userCount -= 2;
                                bal += hSpeed;
@@ -543,7 +553,7 @@ static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s16be(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft)
 {
@@ -561,8 +571,9 @@ static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                userCount -= 2;
                                bal += hSpeed;
                        }
@@ -579,8 +590,9 @@ static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 4)
                                        break;
-                               if (get_user(data, ((u_int *)userPtr)++))
+                               if (get_user(data, (u_int __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 4;
                                userCount -= 4;
                                bal += hSpeed;
                        }
@@ -597,7 +609,7 @@ static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u16be(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft)
 {
@@ -615,8 +627,9 @@ static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                data ^= 0x8000;
                                userCount -= 2;
                                bal += hSpeed;
@@ -634,8 +647,9 @@ static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 4)
                                        break;
-                               if (get_user(data, ((u_int *)userPtr)++))
+                               if (get_user(data, (u_int __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 4;
                                data ^= 0x80008000;
                                userCount -= 4;
                                bal += hSpeed;
@@ -653,7 +667,7 @@ static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_s16le(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft)
 {
@@ -671,8 +685,9 @@ static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                data = le2be16(data);
                                userCount -= 2;
                                bal += hSpeed;
@@ -690,8 +705,9 @@ static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 4)
                                        break;
-                               if (get_user(data, ((u_int *)userPtr)++))
+                               if (get_user(data, (u_int __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 4;
                                data = le2be16dbl(data);
                                userCount -= 4;
                                bal += hSpeed;
@@ -709,7 +725,7 @@ static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
+static ssize_t ata_ctx_u16le(const u_char __user *userPtr, size_t userCount,
                             u_char frame[], ssize_t *frameUsed,
                             ssize_t frameLeft)
 {
@@ -727,8 +743,9 @@ static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 2)
                                        break;
-                               if (get_user(data, ((u_short *)userPtr)++))
+                               if (get_user(data, (u_short __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 2;
                                data = le2be16(data) ^ 0x8000;
                                userCount -= 2;
                                bal += hSpeed;
@@ -746,8 +763,9 @@ static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount,
                        if (bal < 0) {
                                if (userCount < 4)
                                        break;
-                               if (get_user(data, ((u_int *)userPtr)++))
+                               if (get_user(data, (u_int __user *)userPtr))
                                        return -EFAULT;
+                               userPtr += 4;
                                data = le2be16dbl(data) ^ 0x80008000;
                                userCount -= 4;
                                bal += hSpeed;
index d59f60b2641096119a898f67319812aac988b6e4..494070a3f8702e27d95673f4b0253ca24eb29d13 100644 (file)
@@ -34,6 +34,7 @@
 #define DMASOUND_PAULA_REVISION 0
 #define DMASOUND_PAULA_EDITION 4
 
+#define custom amiga_custom
    /*
     *  The minimum period for audio depends on htotal (for OCS/ECS/AGA)
     *  (Imported from arch/m68k/amiga/amisound.c)
@@ -156,7 +157,7 @@ static int AmiStateInfo(char *buffer, size_t space);
      *  Native format
      */
 
-static ssize_t ami_ct_s8(const u_char *userPtr, size_t userCount,
+static ssize_t ami_ct_s8(const u_char __user *userPtr, size_t userCount,
                         u_char frame[], ssize_t *frameUsed, ssize_t frameLeft)
 {
        ssize_t count, used;
@@ -189,7 +190,7 @@ static ssize_t ami_ct_s8(const u_char *userPtr, size_t userCount,
      */
 
 #define GENERATE_AMI_CT8(funcname, convsample)                         \
-static ssize_t funcname(const u_char *userPtr, size_t userCount,       \
+static ssize_t funcname(const u_char __user *userPtr, size_t userCount,        \
                        u_char frame[], ssize_t *frameUsed,             \
                        ssize_t frameLeft)                              \
 {                                                                      \
@@ -240,10 +241,11 @@ GENERATE_AMI_CT8(ami_ct_u8, AMI_CT_U8)
      */
 
 #define GENERATE_AMI_CT_16(funcname, convsample)                       \
-static ssize_t funcname(const u_char *userPtr, size_t userCount,       \
+static ssize_t funcname(const u_char __user *userPtr, size_t userCount,        \
                        u_char frame[], ssize_t *frameUsed,             \
                        ssize_t frameLeft)                              \
 {                                                                      \
+       const u_short __user *ptr = (const u_short __user *)userPtr;    \
        ssize_t count, used;                                            \
        u_short data;                                                   \
                                                                        \
@@ -253,7 +255,7 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount,    \
                count = min_t(size_t, userCount, frameLeft)>>1 & ~1;    \
                used = count*2;                                         \
                while (count > 0) {                                     \
-                       if (get_user(data, ((u_short *)userPtr)++))     \
+                       if (get_user(data, ptr++))                      \
                                return -EFAULT;                         \
                        data = convsample(data);                        \
                        *high++ = data>>8;                              \
@@ -268,12 +270,12 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount,  \
                count = min_t(size_t, userCount, frameLeft)>>2 & ~1;    \
                used = count*4;                                         \
                while (count > 0) {                                     \
-                       if (get_user(data, ((u_short *)userPtr)++))     \
+                       if (get_user(data, ptr++))                      \
                                return -EFAULT;                         \
                        data = convsample(data);                        \
                        *lefth++ = data>>8;                             \
                        *leftl++ = (data>>2) & 0x3f;                    \
-                       if (get_user(data, ((u_short *)userPtr)++))     \
+                       if (get_user(data, ptr++))                      \
                                return -EFAULT;                         \
                        data = convsample(data);                        \
                        *righth++ = data>>8;                            \
index 1ddaa6284b08f745d800fffaf428bd41450d486a..e2081f32b0c45904246961f450889956e962ba6b 100644 (file)
@@ -58,7 +58,7 @@ static void Q40Interrupt(void);
 
 
 /* userCount, frameUsed, frameLeft == byte counts */
-static ssize_t q40_ct_law(const u_char *userPtr, size_t userCount,
+static ssize_t q40_ct_law(const u_char __user *userPtr, size_t userCount,
                           u_char frame[], ssize_t *frameUsed,
                           ssize_t frameLeft)
 {
@@ -79,7 +79,7 @@ static ssize_t q40_ct_law(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t q40_ct_s8(const u_char *userPtr, size_t userCount,
+static ssize_t q40_ct_s8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft)
 {
@@ -98,7 +98,7 @@ static ssize_t q40_ct_s8(const u_char *userPtr, size_t userCount,
        return used;
 }
 
-static ssize_t q40_ct_u8(const u_char *userPtr, size_t userCount,
+static ssize_t q40_ct_u8(const u_char __user *userPtr, size_t userCount,
                          u_char frame[], ssize_t *frameUsed,
                          ssize_t frameLeft)
 {
@@ -114,7 +114,7 @@ static ssize_t q40_ct_u8(const u_char *userPtr, size_t userCount,
 
 
 /* a bit too complicated to optimise right now ..*/
-static ssize_t q40_ctx_law(const u_char *userPtr, size_t userCount,
+static ssize_t q40_ctx_law(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -152,7 +152,7 @@ static ssize_t q40_ctx_law(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t q40_ctx_s8(const u_char *userPtr, size_t userCount,
+static ssize_t q40_ctx_s8(const u_char __user *userPtr, size_t userCount,
                           u_char frame[], ssize_t *frameUsed,
                           ssize_t frameLeft)
 {
@@ -189,7 +189,7 @@ static ssize_t q40_ctx_s8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t q40_ctx_u8(const u_char *userPtr, size_t userCount,
+static ssize_t q40_ctx_u8(const u_char __user *userPtr, size_t userCount,
                           u_char frame[], ssize_t *frameUsed,
                           ssize_t frameLeft)
 {
@@ -224,7 +224,7 @@ static ssize_t q40_ctx_u8(const u_char *userPtr, size_t userCount,
 }
 
 /* compressing versions */
-static ssize_t q40_ctc_law(const u_char *userPtr, size_t userCount,
+static ssize_t q40_ctc_law(const u_char __user *userPtr, size_t userCount,
                            u_char frame[], ssize_t *frameUsed,
                            ssize_t frameLeft)
 {
@@ -265,7 +265,7 @@ static ssize_t q40_ctc_law(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t q40_ctc_s8(const u_char *userPtr, size_t userCount,
+static ssize_t q40_ctc_s8(const u_char __user *userPtr, size_t userCount,
                           u_char frame[], ssize_t *frameUsed,
                           ssize_t frameLeft)
 {
@@ -304,7 +304,7 @@ static ssize_t q40_ctc_s8(const u_char *userPtr, size_t userCount,
 }
 
 
-static ssize_t q40_ctc_u8(const u_char *userPtr, size_t userCount,
+static ssize_t q40_ctc_u8(const u_char __user *userPtr, size_t userCount,
                           u_char frame[], ssize_t *frameUsed,
                           ssize_t frameLeft)
 {
index 23562e947806bb73f05fc37b3e6305af6fda56cb..ca973ac2a30a653e698af58de3ac7a5f875b8bca 100644 (file)
@@ -17,6 +17,7 @@
 #include <asm/uaccess.h>
 #include "dmasound.h"
 
+extern int expand_bal; /* Balance factor for expanding (not volume!) */
 static short dmasound_alaw2dma16[] ;
 static short dmasound_ulaw2dma16[] ;
 
index 4600cd6742ceaca0c397efd42fcc8d9ef01f852b..abc242abd5b111ba5dea82c2d51889a26a9a45b6 100644 (file)
@@ -312,7 +312,8 @@ static struct pci_device_id i810_pci_tbl [] = {
         PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4},
        {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_18,
         PCI_ANY_ID, PCI_ANY_ID, 0, 0, INTELICH4},
-
+       {PCI_VENDOR_ID_NVIDIA,  PCI_DEVICE_ID_NVIDIA_CK804_AUDIO,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, NVIDIA_NFORCE},
        {0,}
 };
 
@@ -3427,7 +3428,6 @@ out_iospace:
                release_mem_region(card->ac97base_mmio_phys, 512);
                release_mem_region(card->iobase_mmio_phys, 256);
        }
-out_pio:       
        release_region(card->ac97base, 256);
 out_region2:
        release_region(card->iobase, 64);
index 1a903390ad6dc99d79a16bade1c498246b88789a..5098372527351628d14fb2c861c71d276de9f4ac 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <sound/driver.h>
 #include <linux/pci.h>
+#include <linux/capability.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>